您的位置:首页 > 其它

第四周作业——第七章

2018-03-28 19:17 387 查看
7-1 汽车租赁car=input('what kind of cars do you want?')
print("let's me see if i can find you a ",car)输出PS C:\Users\wula\Desktop\大二下课程\高编\python_work> python .\第七章.py
what kind of cars do you want?Subaru
let's me see if i can find you a Subaru7-3  10的整数倍num=input("please enter a number: ")
num=int(num)
if num%10 == 0:
print('this number is an integer multiple of 10')
else:
print('this number is not an integer multiple of 10')输出PS C:\Users\wula\Desktop\大二下课程\高编\python_work> python .\第七章.py
please enter a number: 25
this number is not an integer multiple of 10
PS C:\Users\wula\Desktop\大二下课程\高编\python_work> python .\第七章.py
please enter a number: 20
this number is an integer multiple of 107-5  电影票i=0
while i<3:
i=input('how old are you? ')
i=int(i)
if i<3:
print('the ticket price is free.')
elif 3<= i<=12:
print('the ticket price is 10 dollar.')
else:
print('the ticket price is 15 dollar.')
i += 1输出PS C:\Users\wula\Desktop\大二下课程\高编\python_work> python .\第七章.py
how old are you? 16
the ticket price is 15 dollar.
PS C:\Users\wula\Desktop\大二下课程\高编\python_work> python .\第七章.py
how old are you? 11
the ticket price is 10 dollar.7-8 熟食店sandwichs = ['potato','apple','pear']
finished_sandwich=[]
while sandwichs:
sandwich= sandwichs.pop()
print("i made ",sandwich,"sandwich.")
finished_sandwich.append(sandwich)
for temp in finished_sandwich:
print(temp)输出i made pear sandwich.
i made apple sandwich.
i made potato sandwich.
pear
apple
potato
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: