码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2017-09-13 18:30:53      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:python   else   测试   转型   input   compare   print   int   数字   

## 输入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

标签:python   else   测试   转型   input   compare   print   int   数字   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!