python基础篇—编程入门程序-成都快上网建站

python基础篇—编程入门程序

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


网站栏目:python基础篇—编程入门程序
网页URL:http://kswjz.com/article/jcppps.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流