• python1


    if else:

    guess_age = int(input("please input a age:"))

    age = 59 #变量名不能以空格开头

    #if else 直接用:冒号来区分,相对来说比较简单
    if age == guess_age:

    print("you got the right age")
    else:

    print("sorry,you are wrong")

    特殊:l连比运算符----------------------------------
    #if elfi: else:
    if age == guess_age:

    print("you are right")
    elif age > guess_age:
    print("you need a big one")
    else:
    print("you need a small one")
    a = 100
    b = 1000

    c = int(input("input a number:"))

    if a <= c <= b :

    print(" it's true")
    else:
    print ("flase")

    input---------------------------------------------------------------

    name = input ("your name:")

    age = input ("your age:")
    #input 所接收到的,所有输入的,都会被识别为字符串,即使输入的是数字

    old = 100
    #这里用了两种拼接方式,一种是用逗号,另一种是用加号(同一类型的相关拼接好,字符串和字符串之间,或是数字和数字之间。)
    print(name,"you can still live",old + int(age),"years")#逗号空格
    print(name,"you cat still to live " + str(old + int(age))+ " years")#加号没空格
  • 相关阅读:
    自己搭建一个vue项目
    nodejs 后台开发入门
    bootstrap table入门例子
    datatable入门
    猜数字案例
    Cookie
    管理系统案例
    PHP操作数据库(以MySQL为例)
    数据库(以MySQL为例)
    案例:音乐列表
  • 原文地址:https://www.cnblogs.com/dongjieyuan/p/9048640.html
Copyright © 2020-2023  润新知