您好,登录后才能下订单哦!
1、小程序
实现用户交互,引号,判断用法,变量实现。
[root@node1 day1]# cat jiaohu.py
#!/usr/bin/env python
#!coding:utf-8
name = raw_input('what your name?: ')
age = raw_input('how old are you?: ')
sex = raw_input('what your sex?: ')
job = raw_input('what is yout jobs?: ')
msg = """
Infomation of commpany staff:
Name : \033[42;1m%s\033[0m;
Age : %s
Sex : \033[31;1m%s \033[0m;
Job : %s
""" %(name, age, sex, job)
if int(age)>50:
print "You too old, you can onlu work ..."
elif int(age)>30:
print "you are in middle age, go on ..."
else:
print 'you still very young ...'
print msg
[root@node1 day1]#
2、while循环练习
[root@node1 day1]# cat whilet.py
#!/usr/bin/env python
#!coding:utf-8
i = 0
while True:
i = i + 1
if i == 5:
print 'I have got to the 50th'
continue
elif i>9:break
print i
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。