input()
reads a line from stdin and returns it: username = input('Username: ') password = input('Password: ') if username == 'Rene' and password == 'secretGarden': print('Bingo') else: print('Wrong username or password')
input
, the value that the user enters is displayed on the console. This is not always desired, especially when entering passwords. In order to hide the entered value, the function getpass()
, found in the equally named standard library module getpass can be used: from getpass import getpass username = input ('Username: ') password = getpass('Password: ') if username == 'Rene' and password == 'secretGarden': print('Bingo') else: print('Wrong username or password')