In this python if else program, we will display 1/0 if the user gives Hello/Bye as output.
Steps to solve the program
- Take input through the user.
- Using an if-else statement display 1/0 if the user gives Hello/Bye as output.
- Print the respective output.
iput = input("Enter your choice: ")
if iput == "Hello":
print(1)
elif iput == "Bye":
print(0)
else:
print("Invalid choice")
Output :
Enter your choice: Bye
0