美文网首页
2.5 Python的判断

2.5 Python的判断

作者: 要树立远大的理想 | 来源:发表于2018-11-22 17:42 被阅读0次

    Python中的判断用的是if


    下面举例说明
    输入代码
    c1 = int(input("请输入1个数字\n"))
    c2 = 10
    if c1 > c2:
        print("数字有点大")
        print("答案中的数字为:" + str(c2))
        print("你输入的数字为" + str(c1))
    elif c1 < c2:
        print("数字有点小")
        print("答案中的数字为:" + str(c2))
        print("你输入的数字为" + str(c1))
    else:
        print("答对了")
        print("答案中的数字为:" + str(c2))
        print("你输入的数字为" + str(c1))
    

    输出结果

    请输入1个数字
    9
    数字有点小
    答案中的数字为:10
    你输入的数字为9
    

    相关文章

      网友评论

          本文标题:2.5 Python的判断

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