Why is this not working properly? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why is this not working properly?

I made this password validation code bit for practice but there's a problem: When input is hello@12, it finds it valid. My friend gave a random input "shin@chan1", it found invalid. Kindly solve this problem. Thankyou. https://code.sololearn.com/cdCxc6wJunCi/?ref=app

5th Jun 2020, 4:44 PM
Noob Gamer
Noob Gamer - avatar
2 Answers
+ 4
Line 13 should not have -1 in the range definition. While there is, you never check the last character, which in the case you described is the sole digit. This is why the number check fails.
5th Jun 2020, 4:50 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
Thanks brother.
6th Jun 2020, 4:52 AM
Noob Gamer
Noob Gamer - avatar