python - How to delete a print command in certain results -
how delete command in result:
pass1 = input("what password: ") pass2 = input("rewrite password: ") if len(pass1) > 5: print ("") else: print ("your password must @ least 5 characters long") print ("*******************") print ("loading...") print ("*******************") time.sleep(1) if pass1 == pass2: print ("all right, password is: " + pass1) else: print ("sorry, passwords don't match")
basically when run , type in password not 5 characters long still shows password is.
what trying when password not 5 characters long want make not show up.
if pass1 == pass2: print ("all right, password is: " + pass1) else: print ("sorry, passwords don't match")
just move relevant code inside if
branch:
pass1 = input("what password: ") pass2 = input("rewrite password: ") if len(pass1) > 5: print ("") print ("*******************") print ("loading...") print ("*******************") time.sleep(1) if pass1 == pass2: print ("alright, you're password is: " + pass1) else: print ("sorry, passwords don't match") else: print ("your password must @ least 5 characters long")
Comments
Post a Comment