0
Why does the code fail the test?
I wrote the code for the "password validation" task; it fails for the last two tests. Please tell me how to fix it, I will be very grateful) https://code.sololearn.com/c7fiu4W7Kk4o/?ref=app
3 Antworten
+ 4
One problem resides in this line:
if i in str(range(0,10))
You are transforming the range object to its string representation which is not what you want.
(because it looks like this: 'range(0, 10)'
Instead you can just write:
if i in '0123456789'
+ 1
Thanks you)
0
You can use `''.join(map(str, range(10)))` to get a string of '0123456789'.