-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatements.py
More file actions
57 lines (51 loc) · 1.65 KB
/
Copy pathstatements.py
File metadata and controls
57 lines (51 loc) · 1.65 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# nested statement
# print("Welcome to the rollercoaster!")
# height = int(input("What is your height in cm? "))
# if height >= 120:
# print("You can ride the rollercoaster")
# age = int(input("what is the age?"))
# if age <= 18:
# print("you have to pay $7")
# else:
# print("you have to pay $12")
# else:
# print("Sorry you have to grow taller before you can ride.")
# elif statement
# print("Welcome to the rollercoaster!")
# height = int(input("What is your height in cm? "))
#
# if height >= 120:
# print("You can ride the rollercoaster")
# age = int(input("what is the age?"))
# if age <= 12:
# print("you have to pay $5")
# elif age <= 18:
# print("you have to pay $12")
# else:
# print("you have to pay $7")
# else:
# print("Sorry you have to grow taller before you can ride.")
# multiple example
print("Welcome to the rollercoaster!")
height = int(input("What is your height in cm? "))
if height >= 120:
print("You can ride the rollercoaster")
age = int(input("what is the age?"))
if age <= 12:
bill = 5
print("you have to pay $5")
elif age <= 18:
bill = 12
print("you have to pay $12")
else:
bill = 7
print("you have to pay $7")
photos = input("Do you want photos? ")
if photos == "yes":
bill += 3
print("your total bill is:" + str(bill))
# print(f"your total bill is {bill}")
else:
print(f"your total bill is {bill}")
else:
print("Sorry you have to grow taller before you can ride.")