美文网首页python
函数input()的工作原理

函数input()的工作原理

作者: 庵下桃花仙 | 来源:发表于2018-11-02 21:54 被阅读8次
    # 7-1
    need_car = input("请问,您想租什么车?")
    print("让我看看是否能找到" + need_car + "。")
    
    # 7-2
    people_num = input("请问有多少人就餐: ")
    prople_num = int(people_num)
    
    if prople_num > 8:
        print("抱歉,没有空位了!")
    else:
        print("好的,还有空位!")
    
    # 7-3
    prompt = "Enter a numberm, and I will tell you if it is an integer multiple of 10."
    prompt += "\nnumber: "
    number = input(prompt)
    number = int(number)
    
    if number % 10 == 0:
        print("\nThe number" + str(number) + " is an integer multiple of 10.")
    else:
        print("\nThe number " + str(number) + " is not an integer multiple of 10")
    
    请问,您想租什么车?特斯拉
    让我看看是否能找到特斯拉。
    请问有多少人就餐: 8
    好的,还有空位!
    Enter a numberm, and I will tell you if it is an integer multiple of 10.
    number: 99
    
    The number 99 is not an integer multiple of 10
    

    相关文章

      网友评论

        本文标题:函数input()的工作原理

        本文链接:https://www.haomeiwen.com/subject/uslhxqtx.html