-3

I have been trying to make a login, so what I wanna do is, you can read from below but my problem is that, I wanna make such that if I enter a wrong username, I will start again at the top, How do I do that?

name=(input('Enter your valid username:'))


    if (name=='your valid username'):
        password = (input('Enter your password:'))
        if (password=='nabil165'):
            print('Welcome back Nabil!')
    else:
        print("Try again!")
        name = (input('Enter your valid username:'))

1 Answers1

0

In my opinion you should create a list/array of valid user names then compare the entered usernames with the usernames that are in the list/array then you will be able to write authentication logic using if else

dc7
  • 401
  • 1
  • 4
  • 13