第四周作业——第七章

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  Subaru

7-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 10

7-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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值