zoukankan      html  css  js  c++  java
  • if else

    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")#加号没空格
  • 相关阅读:
    实现跨域的几种方法
    2015-07-15
    unity3d中给GameObject绑定脚本的代码
    unity3d的碰撞检测及trigger
    区块链 (未完)
    mono部分源码解析
    量化策略分析的研究内容
    mono搭建脚本整理
    unity3d简介
    Hook技术之API拦截(API Hook)
  • 原文地址:https://www.cnblogs.com/nfyx/p/8776529.html
Copyright © 2011-2022 走看看