14
Last seen 4 months ago
Member for 5 years, 10 months, 2 days
Difficulty Normal
Cool, but not optimal solution.
**strip()** Return a copy of the string with the leading and trailing characters removed. we need only first word Why do you need care about trailing characters?
split() Return a list of the words in the string, using sep as the delimiter string. If maxsplit is give
More
maybe you can think about why do you create 2 addition variable and perform slicing of text? Maybe you read about function find and refactor your solution.
More
Good solution, but I recommend you to read "PEP 8 -- Style Guide for Python Code"
More
Optimal solution, but creating of nb is not necessary. You can use return several times.
More
True if (index_second - index_first) == 1 else False is unnecessary you may simple write (index_second - index_first) == 1 result will be same
More
please read about re.findall your solution can be improved
More
your code made text.lower().split() on each iteration. You can make more optimal solution.
More
good approach, but when you count symbol you should check all text. you can be more optimal.
More
Please note args has type tuple!
Why did you make list from tuple?
You can find out max or min from tuple like you made with list
More
rather good. It is useful to you to find out information about this "the value (an empty list or dict) must be initialized the first time a given key is used. While this is relatively easy to do manually, the defaultdict type automates and simplifies these kinds of operations." see more https://www.
More
Cool, but difficult to understand.
Checking 'right' in i maybe impove speed, but replace make this although.
More
making bicycle more and more times, it is not optimal, but for exercise may be usefull
More
len(set(elements)) == 0 or len(set(elements)) == 1 equivalent len(set(elements))<=1
More