31
Andrey Solomatin
Last seen 1 year ago
Member for 11 years, 2 months, 8 days
Difficulty Normal
publication hint:
remove all test code manually, auto cutter leaves some dummy comments
More
No need parenthesis
#return (wingman1, wingman2)
return wingman1, wingman2
Constructions **if (cond) return True else False** can be simplified **return cond** or **return bool(cond)**
You can rewrite check to accept tuple and make both check inside **check\_wingman(pawns, wingman\_p
More
You dont need subtract and add 97 and 49.
No need to check coner cases. If coord is out of field check will return "no pawn here"
More
You convert char to int and check ints. It is more simple and readable to check char in string. You can import all required sequences from moddule **string**
More
Oneliner is good then it fits screen (80 or 120 chars) but in such cases it is hard to read.
More
**lambda x: abs(x)** is same as **abc**
You did not need **set** by preconditions
More
You totally ignored hints.
Please follw python coding style(PEP8)
Use python unpacking to iterate over **C**.
# for i in range(len(C)):
# if C[i][1] == 'n':
for val, sign in C:
if sign == 'n':
In most cases you dont need construction like **range(len(iterable))**
More
python allow to iterate over collection in simple way
for word in words:
if word in ...
More
You dont need to split string to small strings, **in** works fine on it.
check construction can be simplified:
# 1 if i in x.lower() else 0
int(i in x.lower())
bool is subclass of int and you can just add result of check to count **count += i in x.lower()**
More
You have good solution except one thing. And this thing is docstring:
* We have documentation for this function at another palace. (task description)
* You docstring is incorrect. (**from a list of words** should be **from set of words**)
* You have typo in **occurence**
More
Can you explain why you convert set to list in line 3?
Better to use **in** instead of **find**
**cc = cc+1** => **cc =+ 1**
I prefer to reuse variables if it is applicable **text = text.lower()**
More
You should not use **re** in this case. For this case **word in text.lower()** is enough.
More
Please read description carefully: **Words are given in lowercase**
More
You dont need to split text for chunks. You can check word directly in text.lower()
More
you dont need to split text for chunks, you can check directly in text.lower()
**list** is bad name for variable
More