Oct-24-2017, 06:49 PM
(This post was last modified: Oct-24-2017, 06:51 PM by MethodRunner147.)
Hi, I am trying to let a user input a username that is 8 characters long . Then if they enter it incorrectly, display an error message and ask them to enter a correct username. Every time I enter an 8 digit long username, it still says it is an invalid username. I have left the code below. Any help is appreciated.
import re username = str(input("Please enter an 8 digit username: ")).lower() if username ==("[a-z]{8}"): print("Valid username") else: str(input("Please enter a valid username"))