40
suic
16 39 57
9964/ 10664
Last seen 4 days ago
Member for 9 years, 10 months, 19 days
Difficulty Advanced
Best reviews / Newest reviews
First-StaticFuzz
Hi, this try: int(xy) except ValueError: ... is quite ugly and in fact you don't have to do that as there is the _str.isalpha()_ method: if string.isalpha(): word_seq += 1 else: word_seq = 0 More
First-andraz.gruden.90
This is a great example how comments can make code unreadable. More
First-andraz.gruden.90
Hi, few things: 1. Readability counts... 2. This is not true, as text is iterable: > text=list(text) #we have to create separate values to interate 3. You use text.count(char) three times so it's worth to make it variable. After all these changes: def checkio(text): text, counter More
First-andraz.gruden.90
Hi, what's the point of lines 1 to 14? More
First-aflorencek
Hi, look at _list comprehensions_. More
First-RomanZhyvitski
Hi, try to look at [__set__](https://docs.python.org/3/library/stdtypes.html?highlight=set.intersection#set-types-set-frozenset) in Python. In fact you need to return a sorted set intersection. def checkio(first, second): first = set(first.split(",")) second = set(second.split(" More
First-RomanZhyvitski
Hi, there's a _str.join()_ function, so you don't need the for loop. And consider that __str__ is immutable in Python is immutable. return "".join(i for i in text if i.isupper()) # or: return "".join(filter(str.isupper, text) In fact you don't need the _if_ as what it checks is a pr More
First-RomanZhyvitski
Hi, you can use * to unpack values e. g.: dat1=datetime.date(*date1) More
First-RomanZhyvitski
Hi, reverse=False is redundant as it's the default value. More
First-cierand
And now get rid of joined_string :) More
First-Pyromanser
Ok, and now get rid of unswer, as you don't need it. More
First-skninja
Hi, you can replace lines 5-10 with: return ','.join(list_phrases).replace('right', 'left') 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-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
curse-casilda 1
Hi, ... good, evil... that's funny :) but line 10 isn't: return ",".join(curse) # is enough More
First-OleksiyKhomenko 1
Hi, () around the expression are redundant. More
First-amarshukla
Hi, there's some redundancy in your code: 1. You don't need to iterate over whole `data`. One `isSmall`, `isCaps`, `isLower` True, you don't need to continue. 2. You don't need to check each condition in every iteration. 3. `if...else` of lines 5 and 15 is redundant. def checkio(data): More
First-CaptCalculator
Hi, you could shorten it :) ~~~~ class Friends(): def __init__(self, connections): self.connections = list(connections) def add(self, connection): if connection not in self.connections: self.connections.append(connection) return True return F More
First-CaptCalculator
Hi, sum(word in text.lower() for word in words) could be more efficient. More
First-kenaniah
Hi, the only thing I would change: > `*` list/set/dictionary comprehensions More