ho = {'aaaa':1111, 'bbbb':2222, 'cccc':3333} Please enter print('ID'.') a = input() if a in ho: print('Please enter your password.') else: print ('There is no such ID')
print('password'.')
b = input()
password = ho[a]
if password == b:
print("You have successfully logged in."),
else:
print("!!Login failed!!")
It keeps saying that I failed... The password value is 1111 and the input value of b is 1111 Why doesn't the conditional statement work...
python
If you enter b = input(), the string '1111' is in b It's different from the integer 1111.
b = int(input())
Change to or change the value to a string
'aaaa':'1111'
© 2024 OneMinuteCode. All rights reserved.