According to Data Science Topic-12 If else program examples
# email- abhayprasad.36480@gmail.com
# password-1234
email = input('Enter your email: ')
password = input('Enter your password: ')
if email == 'abhayprasad.36480@gmail.com' and password == '1234':
print('Welcome')
elif email == 'abhayprasad.36480@gmail.com' and password != '1234':
# tell the user
print('Incorrect password')
password = input('enter password again')
if password == '1234':
print('Welcome,finally!')
else:
print('beta tumse na ho payega!')
else:
print('Not correct')
Result: Enter your email: abcd
Enter your password: 7689
Not correct
Enter your email: abhayprasad.36480@gmail.com
Enter your password: 1234
Welcome
Result: first num4
second num1
third num10
smallest is 1
# menu driven calculator
fnum = int(input('enter the 1st number'))
snum = int(input('enter the 2nd number'))
op = input('Enter the operation')
if op == '+':
print(fnum+ snum)
elif op == '-':
print(fnum-snum)
elif op== '*':
print(fnum*snum)
else:
print(fnum/snum)
Result: enter the 1st number45
enter the 2nd number34
Enter the operation+
79
enter the 1st number67
enter the 2nd number56
Enter the operation
1.1964285714285714
# menu driven calculator
menu = input("""
Hi!How can i help you.
1. Enter 1 for pin check
2. Enter 2 for balance check
3. Enter 3 for withdrawal
4. Enter 4 for exit
""")
if menu== '1':
print('pin change')
elif menu== '2':
print('balance check')
elif menu== '3':
print('withdrawal')
else:
print('exit')
Result: Hi! How can i help you.
1. Enter 1 for pin check
2. Enter 2 for balance check
3. Enter 3 for withdrawal
4. Enter 4 for exit
3
withdrawal
Comments
Post a Comment