I have the following code:
- username = ‘name of user’
2.user = input(‘Please enter your username: ‘)
3.if(user==username):
4.print(Welcome, name of user’)
5.else:
6.print(‘That is not correct. Please try again”)
If I enter an incorrect username into the terminal and it sends me to the ‘else’ statement, how can I get the code to prompt me to enter the username again until I enter the correct username? I’ve tried to look up videos about loops, but I’m having a hard time understanding the concept. I’d appreciate if somebody could dumb this down for a beginner
submitted by /u/Take-The-L-Train
[link] [comments]
r/learnpython I have the following code: username = ‘name of user’ 2.user = input(‘Please enter your username: ‘) 3.if(user==username): 4.print(Welcome, name of user’) 5.else: 6.print(‘That is not correct. Please try again”) If I enter an incorrect username into the terminal and it sends me to the ‘else’ statement, how can I get the code to prompt me to enter the username again until I enter the correct username? I’ve tried to look up videos about loops, but I’m having a hard time understanding the concept. I’d appreciate if somebody could dumb this down for a beginner submitted by /u/Take-The-L-Train [link] [comments]
I have the following code:
- username = ‘name of user’
2.user = input(‘Please enter your username: ‘)
3.if(user==username):
4.print(Welcome, name of user’)
5.else:
6.print(‘That is not correct. Please try again”)
If I enter an incorrect username into the terminal and it sends me to the ‘else’ statement, how can I get the code to prompt me to enter the username again until I enter the correct username? I’ve tried to look up videos about loops, but I’m having a hard time understanding the concept. I’d appreciate if somebody could dumb this down for a beginner
submitted by /u/Take-The-L-Train
[link] [comments]