首页 > 编程语言 > 详细

python学习过程中随手写的测试脚本-testif.py

时间:2017-09-13 18:14:42      阅读:291      评论:0      收藏:0      [点我收藏+]

## 输入name
##name = input(‘What is your name ‘)
name = ‘stan‘

## test for if,elif
if name == ‘stan‘:
print(‘1. yes , your are stan‘ )
print(‘here is if‘)
elif name == ‘vanees‘:
print(‘2. not stan, you are vanees‘ )
print(‘here is elif‘)
else:
print(‘9. other people , your name is‘, name )
print(‘here is else‘)

##注意数字转型
tnum = input (‘compare with 5 ,number is ‘)
##此时t_num为string,需要转型为int
tnums = int(tnum)

if tnums<5:
print(‘tnum<5, it is‘,tnums)
else:
print(‘tnum>=5, it is‘,tnums)

python学习过程中随手写的测试脚本-testif.py

原文:http://www.cnblogs.com/dcbook/p/7516333.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!