Find error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Find error

Guys..give some special characters and find error. it prints 3 times...can anyone help me out... https://code.sololearn.com/cQyFb5lHmg2C/?ref=app

20th Jul 2017, 2:38 AM
Girish Tulabandu
Girish Tulabandu - avatar
9 Answers
+ 2
Hey I found it! Actually it's not an error, but still It just checks for every character in an input whether it is letter or not and prints the else message as many times as the number of non-alphabetical characters in your input So if you want it to print the message once and terminate than you have to make a separate loop/sub-routine checking for improper characters in an input. If smthng found - terminate else - run the main part Hope you'll be able to make it yourself ;)
20th Jul 2017, 4:15 AM
Dinmukhamed Mailibay
Dinmukhamed Mailibay - avatar
+ 8
I find it prints just fine. Can you give a example?
20th Jul 2017, 3:02 AM
Ahri Fox
Ahri Fox - avatar
+ 8
if you want it to stop after the special character detect, just place a exit() after the print on else. that'll stop the message being displayed multiple times
20th Jul 2017, 3:48 AM
Ahri Fox
Ahri Fox - avatar
+ 2
@Ahri @chaocti when you give special characters or numbers it prints else statment two times....check once😊
20th Jul 2017, 3:19 AM
Girish Tulabandu
Girish Tulabandu - avatar
+ 2
I only get once for each special character. If you are getting more than one close the playground/app, reopen it and try again.
20th Jul 2017, 3:22 AM
ChaoticDawg
ChaoticDawg - avatar
+ 2
give more characters and check
20th Jul 2017, 3:24 AM
Girish Tulabandu
Girish Tulabandu - avatar
+ 2
It works fine. It prints the else statement for each character that isn't in [a-z] [A-Z][. ].
20th Jul 2017, 3:29 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Yup, still working fine
20th Jul 2017, 3:29 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
@chaotic bro i can't do anything.... check @dinmukhamed comment
21st Jul 2017, 2:25 AM
Girish Tulabandu
Girish Tulabandu - avatar