Python从⼊门到实践7-1课后习题7.1
汽车租赁:编写⼀个程序,询问⽤户要租赁什么样的汽车,并打印⼀条消息,
如“Let me see if I can find you a Subaru”。
cars = input("What's the car are you want to rent?")
print("Let me see if I can find you a Subaru")
7.2
餐馆订位:编写⼀个程序,询问⽤户有多少⼈⽤餐。如果超过8 ⼈,就打印⼀
条消息,指出没有空桌;否则指出有空桌。
python编程:从入门到实践第二版number = input("What's the number of the people? Please input the number:")
number = int(number)
if number >= 8:
print("It has not table")
else:
print("Plese come in,we have enough table")
7.3
10 的整数倍:让⽤户输⼊⼀个数字,并指出这个数字是否是10 的整数倍。
number = input("If you input a number,I will tell you if the number is multiplier of ten! Please input the number:")
number = int(number)
if number % 10 == 0:
print("It's the multiplier of ten!")
else:
print("It's not the multiplier of ten!")

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。