Python doesn t see variables are equal

0 votes
i=3
def pw():
    global i
    if i==3:
            p=1312
            print('Input the password:')
            print('[You have 3 tries to guess the password!]')
            pu = input()
            if pu == p:
                print('Access Granted!')
            elif pu != p:
                print('Access Denided!')
                print('Passwords dont match!')
                i-=1
                pw()
    elif i==2:
            p=1312
            print('------------------------------------------------------------------------------------------------------------------------')
            print('Input the password:')
            print('[You have 2 tries to guess the password!]')
            pu = input()
            if pu == p:
                print('Access Granted!')
            elif pu != p:
                print('Access Denided!')
                print('Passwords dont match!')
                i-=1
                pw()
    elif i==1:
            p=1312
            print('------------------------------------------------------------------------------------------------------------------------')
            print('Input the password:')
            print('[You have 1 try to guess the password!]')
            print('NOTE: If you dont guess the password the computer will shutdown!')
            pu = input()
            if pu == p:
                print('Access Granted')
            elif pu != p:
                print('Access Denided!')
                print('Passwords dont match!')
                print('------------------------------------------------------------------------------------------------------------------------')
                
                i-=1
                pw()

print('Welcome to Your first project.')
print('Please input wanted paramaters!')
print('Please input your name and surname:')
Name = input()
print('Nice to meet you '+ Name)
pw()
Feb 17, 2022 in Python by anonymous

edited 5 days ago 5 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP