[Tutor] (no subject)
Aliyan Navaid
aliyan.navaid at gmail.com
Sun Oct 18 03:58:32 EDT 2020
I want to write a program which list ALL the errors while entering a user
name.
(If I use if elif blocks the program will end at the first error it
catches)
characters = 90
special_characters = True
if characters < 3:
print(“Username too short”)
elif characters > 50:
print(“Username too long”)
elif special_characters:
print(“Special characters not allowed”)
else:
print(“Username is valid”)
#This program only outputs “Username too long” even though there is
another error ( I.e. “Special characters not allowed” )
More information about the Tutor
mailing list