## 17 February 2022 - 1 answer

Python keeps sendin me to wrong password, idk why, anyone have any idea, btw its my first time in python :)

``````i=3
def pw():
global i
if i==3:
p=1312
print('[You have 3 tries to guess the password!]')
pu = input()
if pu == p:
print('Access Granted!')
elif pu != p:
print('Access Denided!')
i-=1
pw()
elif i==2:
p=1312
print('------------------------------------------------------------------------------------------------------------------------')
print('[You have 2 tries to guess the password!]')
pu = input()
if pu == p:
print('Access Granted!')
elif pu != p:
print('Access Denided!')
i-=1
pw()
elif i==1:
p=1312
print('------------------------------------------------------------------------------------------------------------------------')
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('------------------------------------------------------------------------------------------------------------------------')

i-=1
pw()

Name = input()
print('Nice to meet you '+ Name)
pw()
``````

Python keeps sendin me to wrong password, idk why, anyone have any idea, btw its my first time in python :)

`p` is of type number, while `pu` is of type string. You compare a string with a number, so you get `False`. Try replacing `p=1312` with `p="1312"`.