Python 02

作者: Jack_Hsin | 来源:发表于2017-12-06 19:46 被阅读0次

    一. 课上代码

    temp = input("Guess a number:")
    guess = int(temp)
    if guess == 8:
        print("Your answer is correct!")
    else:
        print("Oops, the right answer is 8!")
    print("Game over!")
    

    二. 动动手答案

    1. 编写程序,要求用户输入姓名并打印“你好,姓名!”
    str1 = input("Input your name:")
    print("Hello " + str1 + "!")
    
    1. 编写程序,要求用户输入1到100之间数字并判断,输入符合要求打印“你妹好漂亮”,不符合要求打印“***”
    num = int(input("Please input a number between 1 and 100:"))
    if num == 88:
        print("Your sister is pretty!")
    else:
        print("WTF!")
    

    相关文章

      网友评论

        本文标题:Python 02

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