10
Zac Petersen
Last seen 6 years ago
Member for 10 years, 6 months, 14 days
Difficulty Normal
I draw blueprints for a living. I also enjoy programming, ham radio, and time with the family.
I always like it when I know what algorithm being used, such as BFS. This way I can learn about the algorithm and then go about reading the code to see how it was implemented.
More
Nice list comprehension. It is something I have been meaning to work on it. I think this is a really good solution since you are using all standard operations.
More
I did something similar but I think that this is a much better solution then what I had. I could have made it much more efficient.
More
Nice work at line 9 using the tuples separation. I had to do a little research to figure out what was going on there but now I remember reading about that some place.
I have seen a few people use zip to create a list of tuples like you have done here but I am not sure why someone would do that as
More
Line 10 could be rewriting to
ch.isdigit()
which would match more with your other solutions. Not something critical or even really a comment just something I thought was funny/interesting.
More
I like the use of
u=data[:]
I forgot about using this to copy all the values of a list.
As for the other portion of the code I think you could make improvements by using the data.count(element) functionality. This would eliminate the nested for loops.
More
I see you put a lot of effort into this and I think you did a great job. I think there are some places that could be improved. For example I think you could eliminate the use of all the strings if you were to transpose/rotate your matrix and then test each string like you did at first. There are oth
More
Bravo,
I even tried looking at eval() to see if I could come up with some means to solve the mission.
More
I do like how short you made this but it is unreadable and I really can't even try to follow it at all. I think it could be helped out a lot by just expanding the names of some of the variables more. Such as I don't know what ra, rb,rc really are and I am not sure what the dictionary D does either.
More
I like your return statement. I could have reduced the size of my code if I would have just gone with something like that.
More
I would think that you could rename min to something else since min is actually a system function.
help(min)
Help on built-in function min in module builtins:
min(...)
min(iterable[, key=func]) -> value
min(a, b, c, ...[, key=func]) -> value
With a single iterable argument, return
More
I did the same thing. I have solved this problem a few years ago in a C++ class and thought this would just be funny. I didn't know about choice() I had to do randint() and convert it over. I think you did a great job implementing it.
More
Looks like good clean code. I think you could eliminate the 2nd for loop though by changing around your tests. For example
uniq = []
for u in data:
if data.count(u) != 1:
uniq.append(u)
return uniq
More
Bravo! I like the documentation of the functions. Also I like the assert you used on 9, I have never used assert or knew what it was about till I read this.
https://wiki.python.org/moin/UsingAssertionsEffectively
More
Nice and clean documentation. I like the note about the simplicity of storing the digits since there is only 10 of them.
More
dir(buffer)
['__add__', '__class__', '__cmp__', '__delattr__', '__delitem__', '__delslice__', '__doc__', '__format__', '__getattribute__', '__getitem__', '__getslice__', '__hash__', '__init__', '__len__', '__mul__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__',
More
Looks like a nice solution. I would like to note please watch the language on line #27.
More
Nice solution. I think one thing you could do to make it a little better would be the change the strings into lists so that you don't have to split them later on. You can just do
UNI[data]
instead of
UNI.split(',')[data]
Other then that nice solution.
More