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

12th Feb 2020, 10:15 PM
Александр
Александр - avatar
3 odpowiedzi
+ 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'
12th Feb 2020, 10:18 PM
HonFu
HonFu - avatar
+ 1
Thanks you)
12th Feb 2020, 10:20 PM
Александр
Александр - avatar
0
You can use `''.join(map(str, range(10)))` to get a string of '0123456789'.
13th Feb 2020, 12:08 AM
o.gak
o.gak - avatar