40
suic
16 39 57
9966/ 10664
Last seen 1 day ago
Member for 9 years, 11 months, 4 days
Difficulty Advanced
Best reviews / Newest reviews
First-Japijapo
Hi, float division in boolean algebra task, why? 1. Line 13: return x == y 2. Line 11: return x != y 3. Line 7: return x or y 4. Line 5: return x and y Conclusion: You don't need to import math. More
First-Japijapo
Hi, the print statements are useless. If you really want to comment your code, then _comment_ and don't write print statements like these. More
First-Japijapo 1
Hi, remove print statements before publishing. More
First-Japijapo 1
Man, ... else: S = S Why? You don't need that branch at all. Few tips: 1. Negative indices: array[len(array)-1] == array[-1] 2. You can write x += 1 instead of x = x + 1. 3. Look at _sum()_ function. return sum([::2]) * array[-1] More
First-michal_krk 1
Hi, what's the point of the for loop? You do the same thing len(args) times. # this is enough: def checkio(*args): if not args: return 0 return max(args) - min(args) More
First-Pyromanser
Ok, and now get rid of unswer, as you don't need it. More
curse-casilda 1
Hi, ... good, evil... that's funny :) but line 10 isn't: return ",".join(curse) # is enough More
First-skninja
Hi, you can replace lines 5-10 with: return ','.join(list_phrases).replace('right', 'left') More
First-cierand
And now get rid of joined_string :) More
First-michal_krk 1
Hi, you do the same thing len(phrases) times, why? def left_join(phrases): output = ",".join(phrases) output = output.replace('right', 'left') return output # is enough. # And now get rid of output variable as you don't need it: return ",".join(phrases).re More
First-buttkitchen
Hi, what's the point of: phrases[0:len(phrases)] # why not just phrases # ? More
First-anvitha.bs
Hi, the for loop is re-inventing the wheel as there's _str.join()_ method. And it's a misuse of _re_, as there's _str.replace()_ method. More
First-Algeran
Hi, you can use _str.replace()_ method and replace lines 2-4 with this: return ",".join(phrases).replace('right', 'left') More
First-OleksiyKhomenko 1
Hi, () around the expression are redundant. More
First-mtwtk_man
Hi, 1. You don't need []. 2. You don't need _for_ at all as you can replace all at one, when you first join and then you use _str.replace()_ method. More
First-kley
Hi, one comment: You don't need to replace one by one. __str__ has _str.replace()_ method, so instead of lines 5-8 you can write this: return ",".join(phrases).replace('right', 'left') More
Itertools with Permutations-arma 1 1
Hi, you can shorten it using _any()_: return any(a.endswith(b) for a, b in permutations(words_set, 2)) More
Readable way with IndexError catch-arma 1 1
Hi, why try...except? You can easily handle it by _if_ or _and_. E. g.: if array: ... else: return 0 More
First-evgensaplev 1
Hi, you don't neet !=0 and in fact you don't need len(): if args: ... else: ... # is enough More
First-samarthbhargav
Hi, you can shorten your code by using all(). Instead of nested ifs you can write: return all(any(map(f, data)) for f in (str.isdigit, str.isupper, str.islower)) More