-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path7.1input和while.py
More file actions
49 lines (42 loc) · 1.07 KB
/
7.1input和while.py
File metadata and controls
49 lines (42 loc) · 1.07 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
# input = input("What kind of cars do you want to rent?")
# print(f"Let me see if I can find you a {input}.")
# int 把input的内容由字符串转换为整数数值 可用于比较
'''
people = input("How many people are in you dinner group")
people = int(people)
if people > 8:
print("NO seats")
else:
if people % 2 == 0:
print("We have seats")
else:
print("NO seats")
# while 循环
prompt ="Tell me some things, I will back "
prompt += "\nEnter 'quit' to end program"
while True:
message = input(prompt)
if message != 'quit':
print(message)
else:
break # 退出循环
'''
'''
while True:
age = input("How old are you")
age = int(age)
if age <= 3:
print("Your ticket ids free")
elif age <= 12:
print("Your tickert is $10")
else:
print("Your ticketis $15")
'''
active = True
while active:
height = int(input("How tall are you?"))
if height >= 180:
print("Youi can pass")
elif height < 180:
print("You can not pass")
active = False