0
Password Validation Help
Can somebody fix my code at lin 13 and 14: https://code.sololearn.com/c67X0lU2aUWy/?ref=app
7 ответов
+ 6
https://code.sololearn.com/c0L3yI5lHyRf/?ref=app
You mustn’t put:
letter = letter.append(x)
or
nums2 = nums2.append(x)
Because it throws an error
Just put:
letter.append(x)
and
nums2.append(x)
+ 2
Ayush Ghara First, why did you word-split the user input (input().split())? This way, the loop iterates on words, while I guess you want to iterate on chars, right?
Also, you can use strings instead of lists. Same logic, very few changes (just replace the "append"s), and a way more readable final code.
Finally, the linked code doesn't have the correction suggested by Ugulberto Sánchez . It's correct. Leave it there.
+ 2
Thank you Sir Emerson Prado and Ugulberto Sánchez, I am able to complete it
+ 1
Ugulberto Sánchez I changed it, but then too many test cases are being failed. Do you have any idea how to solve it ?
+ 1
Hmmm… i’ll think
0
Thanks, it was helpful
0
Hi, you should not store the value inside a variable that have the same name as the variable you want to append. To solve this issue, there are 2 possible ways.
The first one is to do it without assigning its values to a variable, such as:
letter.append(x)
The second possible way could be to store it in a variable that has different name from the variable you want to append, such as:
test = letter.append(x)
Hope that helps.