0

Password Validation Help

Can somebody fix my code at lin 13 and 14: https://code.sololearn.com/c67X0lU2aUWy/?ref=app

24th Apr 2023, 5:25 AM
Ayush Ghara
Ayush Ghara - avatar
7 Antworten
+ 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)
24th Apr 2023, 6:58 AM
Ugulberto Sánchez
Ugulberto Sánchez - avatar
+ 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.
24th Apr 2023, 10:31 AM
Emerson Prado
Emerson Prado - avatar
+ 2
Thank you Sir Emerson Prado and Ugulberto Sánchez, I am able to complete it
24th Apr 2023, 12:10 PM
Ayush Ghara
Ayush Ghara - avatar
+ 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 ?
24th Apr 2023, 10:07 AM
Ayush Ghara
Ayush Ghara - avatar
+ 1
Hmmm… i’ll think
24th Apr 2023, 10:23 AM
Ugulberto Sánchez
Ugulberto Sánchez - avatar
0
Thanks, it was helpful
24th Apr 2023, 10:05 AM
Ayush Ghara
Ayush Ghara - avatar
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.
25th Apr 2023, 1:41 PM
Danish Zubair
Danish Zubair - avatar