input和while

print("----")
message = input("Tell me something, and I will repeat it back to you: ")
print(message)

print("----")
name = input("Please enter your name: ")
print("Hello, " + name + "!")

print("----")
prompt = "If you tell us who you are, we can personalize the message you see."
prompt += "\nWhat is your name? "
name = input(prompt)
print("\nHello, " + name + "!")

print("----")
age = input("How old are you? ")
if int(age) > 18:
    print("Over 18")

print("----")
height = input("How tall are you, in inches? ")
height = int(height)

if height >= 36:
    print("\n You are tall enough to ride!")
else:
    print("\n You'll bee able to ride when you're a little older.")
    
print("----")
number = input("Enter a number, and I'll tell you if it's even or odd:")
number = int(number)

if number % 2 == 0:
    print("\nThe number " + str(number) + " is even.")
else:
    print("\nThe number " + str(number) + " is odd.")
    
print("====")
carname = input("What car you want to owe? ")
print("Let me see if I can find you a " + carname)

print("====")
number = input("How many person will come? ")
if int(number) > 8:
    print("No empty seat.")
else:
    print("Have empty seat.")
    
print("====")
number = input("Please input a number: ")
if int(number)%10 == 0:
    print("The number is 10*X.")
else:
    print("The number is not 10*X.")

print("----")
current_number = 1
while current_number <= 5:
    print(current_number)
    current_number += 1

print("----")
prompt = "\nTell me something, and I will repeat it back to you:"
prompt += "\nEnter 'quit' to end the program. "
message = ""
while message != "quit":
    message = input(prompt)
    print(message)
    
print("----")
prompt = "\nTell me something, and I will repeat it back to you:"
prompt += "\nEnter 'quit' to end the program. "
message = ""
while message != "quit":
    message = input(prompt)
    if message != "quit":
        print(message)

print("----")
current_number = 0
while current_number < 10:
    current_number += 1
    if current_number %2 == 0:
        continue
    print(current_number)

print("----")
x = 1
while x <= 5:
    print(x)
    x += 1

print("====")
value = ''
while value != 'quit':
    prompt = 'Please add a part-food:'
    value = input(prompt)
    print(value + " has been added.")

print("====")
prompt = "How old are you?"
value = input(prompt)
while value != 'quit':
    if int(value) < 3:
        print("Free to see the movie.")
    elif int(value) >= 3 and int(value) <= 12:
        print("10$.")
    else:
        print("15$.")
    value = input(prompt)

print("====")
while True:
    prompt = 'Please add a part-food:'
    active = input(prompt)
    if active == 'quit':
        break
    print(active + " has been added.")

print("====")
while True:
    prompt = "How old are you?"
    active = input(prompt)
    if active == 'quit':
        break
    if int(active) < 3:
        print("Free to see the movie.")
    elif int(active) >= 3 and int(active) <= 12:
        print("10$.")
    else:
        print("15$.")
        
print("====")

value = 1
while True:
    print(value)
    value += 1

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值