您当前的位置: 首页 >  Python

qq_34412985

暂无认证

  • 0浏览

    0关注

    1061博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

python-if syntax demo program / single or multiple line comment

qq_34412985 发布时间:2018-12-17 19:02:34 ,浏览量:0

1.guess age

age_of_princal = 56

guess_age = int(   input(">>:") ) '''多行注释 if guess_age == age_of_princal then

    print("yes") else     print("no ") '''

if guess_age == age_of_princal:     print("Yes,you got it..") elif guess_age > age_of_princal:     print("shoud try samller..") else:     print("try bigger ...")

2.

score = int(input("score:")) if score >90:     print("A") elif score >80:     print("B") elif score >70:     print("C") elif score >50:     print("D") else:     print("滚")

3.

msg = "我爱北京天安门?" print(msg) #this code is for .... """print(msg)多行注释 print(msg) print(msg)""" print(msg)   #print(msg)单行注释

4.

death_age = 80 name = input("your name:") age = input("your age:")  #input 接受的所有数据都是字符串,即便你输入的是数字,但依然会被当成字符串来处理

print( type(age) ) #int integer =整数  把字符串转成int,用int(被转的数据) #str string =字符串 把数据转成字符串用str(被转的数据) print("Your name:",name) #print("You can still live for ",  death_age - int(age)," years ....") print("You can still live for " +  str(death_age - int(age)) +" years ....")

关注
打赏
1653291990
查看更多评论
立即登录/注册

微信扫码登录

0.0416s