[Tutor] Valid Username Program

Aliyan Navaid aliyan.navaid at gmail.com
Thu Oct 8 07:29:52 EDT 2020


   def valid_username(username):

       if len(username) < 3:

           print("Username must be atleast 3 characters long")

       elif len(username) > 15:

           print("Username is too long")

       else:

           print("Valid Username")

    

    

   Dear Sir,

   So this program checks the validity of a username.

   I wanted to ask that instead of elif, I could’ve written another If
   statement in this program right ?

   And can you please also explain that when to use elif statement and when
   to use multiple if statements.

    


More information about the Tutor mailing list