-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtip-program.py
executable file
·27 lines (22 loc) · 1011 Bytes
/
tip-program.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# This script was written by GhostSquad57
# www.youtube.com/user/ghostsquad57
# Demonstrats treating a value as a condition
print("You're in a fancy restaurant.")
print("\nYou have finished your meal and you enjoyed it very much.", \
"\nYou request the bill from the waiter and he hands it to you")
print("\nThe waiter clears his throat while holding out his hand. it seems he would like a tip.")
ending2 = "\nYou tell the waiter you have no money to tip him \nand he walks away with a look of disappointment in his face"
ending1 = "\"Thank You!\", \nThe waiter says with a smile on his face"
question1 = input("\nWould you like to give the waiter a tip? [y/n] ")
if question1 == "y":
question2 = int(input("How much will you give him? "))
if question1 == "n":
print(ending2)
# if the amount is equal to or greater than "1", print good ending
elif question2 >= 1:
print(ending1)
# if the amount is equal to or lesser than "0", print bad ending
elif question2 <= 0:
print(ending2)
else:
print(ending2)