15
MackM
2 9 24
978/ 1195
Last seen 9 years ago
Member for 9 years, 11 months, 9 days
Difficulty Normal
Best reviews / Newest reviews
the_most_numbers-burizz
Very nice code! If you wanted to be more concise, you could just use 'args' everywhere you used arg_list. def checkio(*args): if len(args) == 0: return 0 return max(args) - min(args) Works just as well. More
First-Msevilla
There is no need to sort after every number is appended to the 'number' list, once after all numbers are appended would work. More
single line-toufalk
([0]+array)[-1] Is a very clever way of avoiding index errors :-) More
First-Radu
Nice code! If you wanted to be more concise, you could make three changes. 1, args is treated as a tuple (a list you can't edit) so turning them into a list is unnecessary. 2. The '*' is not needed anywhere except in the function argument. 3. Checking to see if there is only 1 argument isn More
First-stephan233
Nice way to filter out the '0's :-) More
First-johndrunner
Subtracting the sets is a good idea! :-) More
First-zulqarnain
bin() returns a string, I didn't know that. Thank you! More
First-stephan233
Am I reviewing my own code? :-) I guess there was one obvious way to do it, what with the hints and all. More
First-shisashi
Sets can not preserve order, so sorting the list before making it a set in lines #2 and #3 is immediately undone. Also, the "sorted()" function returns a list, so "sorted(list(...))" could just be "sorted(...)". def checkio(first, second): f = set(first.split(',')) s = set(s More
First-eamq
abs() is already a function, the lambda is not needed. def checkio(numbers_array): return sorted(numbers_array, key=abs) More
First-exoarn
Very nice comparison, I hadn't thought of doing it like that. More
First-artur02
Very nice code :-) If you didn't want to type out math.XXX each time, you could alter your import statement like this: from math import pi, sqrt, atanh, asin print(pi) >>> 3.1415.... print(sqrt(4)) >>> 2.0 If you want to get even fancier... from math impor More
First-dwarfjay
Very cool recursive function! It would probably start to run slowly as n increases though because triangle(n) is called once on each number for every n above it. triangle(4) calls triangle(1) 4 times, for instance. More
First-gwie
Very clear code, I like it. Why do you convert 'attacked' back into a list after every minute? You could leave it as a set if you wanted. def capture(matrix): time = 0 attacked = {0} new_infected = [] while any(matrix[a][a] > 0 for a in range(len(matr More
First-ciel
Very concise but clear, I like it. More
First-jjfPCSI1
Very nice! If you wanted to shorten the code however, if cmd[1] == "O": try: somme += int(stack.pop()) except: pass Can be: if cmd[1] == 'O' and stack: somme += int(stack.pop()) More
First-autumnm1981
I haven't seen many solutions that move a week at a time, nice job. More
First-Shtucer
Good comment, very clear code :-). More
First-yttamer
Nice, clear code. Just a note though, it's considered bas practice to use a built in function as a variable name (min for minutes is already used for the minimum function). More
1
2
3