python学习过程中随手写的测试脚本

时间:2021-10-01 08:51:47

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