I was wondering if someone here could help better explain For loops than my textbooks.
I'm writing a program in Python where the program askes a user if they're already an existing user. If they are an existing user, the program starts. If they're not an existing user, they're prompted to create a username and password.
I was wondering if someone could help explain how I could use a For Loop to loop the if statement incase a user enters some unexpected input like A or a number.
Thanks
Here's a code snippet of an if statement I have where it goes:
if newuser == "y":
print("Hello New User")
elif newuser == "n":
print("Hello Existing User")
else:
print("Please try again")
whileloop for this, not aforloop. Aforloop steps a variable through an iterable, which doesn't apply to your situation since there is no iterable.