• 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")#加号没空格
  • 相关阅读:
    WebAPI 资料
    TransactionScope事务类的使用
    Go入门笔记34-Go 使用Ioctl
    解决XShell XFTP传输Go可执行文件导致出错问题
    Go入门笔记33-Go 交叉编译
    博客园添加横向菜单
    C# 正则替换、Json格式化等
    Ubuntu批量修改文件后缀
    Linux免密登录
    Go入门笔记32-继承
  • 原文地址:https://www.cnblogs.com/nfyx/p/8553646.html
Copyright © 2020-2023  润新知