Skip to main content

if-else string comparison [==]

What it is is:

password.py

# This program compares two strings.
# Get a password from the user.
password = input('Enter the password: ')

# Determine whether the correct password
# was entered.
if password == 'prospero':
print('Password accepted.')
else:
print('Sorry, that is the wrong password.')
```