23
Hanna_Hofman
6 19 39
3080/ 3195
Alissa Kvashina
Last seen 2 years ago
Member for 10 years, 2 months, 29 days
Difficulty Normal
Best reviews / Newest reviews
Third-ROBCHI 3 3
Why "number % 3 == 0 and number % 5 == 0"? Why nobody uses "number % 15"? More
First-melitaele 1 1
If all elements are the same, they should all be equal to the first one, so no need to bother with indexes. Also, take a look at ```all()``` function. More
First-melitaele 1
There is ```str.find(text)``` function that returns -1 if the ```text``` is not found. You could precalculate indexes of begin and end and work with those. It would be much faster (not that you really care, as these are just exercises). It would also allow you to use things like ```max(begin, 0)``` More
First-melitaele 1 1
You know you can treat string as a list of chars, right? You could filter it and then join back. Also, no need for if at the end, just return result of comparison. More
Save first index and slice string to check its remainder-heitor 1 1
You could use text.find(symbol, first_index+1). No need to slice beforehand if start index is an option for method. And you won't need to add first index as well. More
First-melitaele 1
I'd rather store the result of ```text.find(symbol, text.find(symbol) + 1)``` in a variable. It makes it more obvious that it's the same result. More
First-melitaele 1 1
You could use ```list.index(x)``` instead of copying list over and over. It would be both more readable and faster/cheaper. More
First-marcopunteri 1 1
Nice solution, but consider using a list generator instead of appending in a cycle. It's both faster and more readable. Also, there is such a nice function as ```str.capitalize()``` try using it next time you need to make the first symbol uppercase. More
First-melitaele 1
Just an idea: if you multiply a string by 0 it becomes empty. And you can concatenate strings. So, this can be solved without any ifs. Also, there is a str.lstrip(chars_to_strip) function, that can be helpful here. Treating strings as arrays is often useful and always tempting, but try to think abou More
First-melitaele 1
Boolean expression becomes too long here. It's better to split it somehow. For example, you could take the last condition and put it above (`if 'password' in password.lower(): return False`). Usually people set line length limit somewhere between 100 and 140 symbols and consider that a condition th More
First-melitaele 1
I like generators very much, but try using composition of `map()`, `filter()`, etc. It doesn't look very good in Python because of brackets nesting, but it's a good excercise. More
First-keldon 1 1
Psst, want some hint? chr(ord('e5'[0])-1) will give you 'd' and str(int('e5'[1])-1) will give you '4', so you can just check if 'd4' (sum of previous expressions) is in pawns. It's cooler than writing a dict and rewriting all input More
First-DKD86 1
This solution could become much more readable if you'd come up with more meaningful naves for your variables. Developing a habit of always making good variables' names will save you much time and pain later in your career. More
First-Hanna_Hofman
I've forgot to remove one print() More
First-Hanna_Hofman
I'd like to find a smarter way to form squares list... More
dict FTW-veky 1
Cool. I couldn't find way to form dict autoaticaly and didn't want to type in too much, so my solution is way more complicated. This makes me upset of being lame, but, well, I'm not a professional programmer, just learning :) More
First-Hanna_Hofman
I know it's ugly. I think I'll rework it one day... More
sort aka list-morbidboo
I like your solution, but I have two questions: Why not i.isalpha() instead of regexp? And what for are capital letters in regexp? More
First-RonHelms
Nice solution, but as for me it's better to use mid = len(data)//2 I think that it might be cheaper, and also more clear. More
First-jcg 1
I'd change result[-1].append(x) #some code here result.append([x]) to result[-1] += x #same code here result.append('x') then you can just return result without need to rejoin words More
1
2 3