Hey thanks for letting me know, this whole time I thought the solutions you can see matched your version. I know in 3 this would still work if put all this in another parenthesis and "list" in front, which is still cool
No, it is Python 2. In Python 3 map returns a generator and not a list.
Is this python 3? I didn't know you could do this 😮
not if it can't solve the problem in the first place.
use this test case:
" A stitch in time saves nothing"
This is actually the best solution because it covers sentences that have spaces of variable length
When I run this code, I get a TypeError exception:bad operand type for abs(): 'generator'
Is this to do with Python 3+?
I thought I was clever ;D
Пожалуй я даже не буду показывать своё решение. Стыдно.
why didnt i remember about count() hahaha nice answer!!
You learn something new everyday... This is a very clever solution, props to you mate.
Oh man, I did not know the bin function. That would have made my life so much easier. Welp, now I know, thank you!
This comment is hidden because it contains spoiler information about the solution
He's given a,b = b,a. It means assign the value of a to b, and that of b to a. Or in other words, swap the value between a and b.
The binary values of True and False can be referred to as 1 and 0 respectively. Basically, the solution is taking the element of the list, ['No', 'Yes'], in that respective index, [b], hence, the use of another pair of square brackets.
Here is a link