# -*-coding:utf-8-*-
'''
Created on 2017年4月29日
@author: Administrator
'''
# if
food = raw_input('you name is ')
if food == 'jack':
age = 'kt'
print age
elif food == 'hack':
age = 'kts'
print age
else:
print 'jack'
# this is for
"""
for i in range(10,0-1,-1):
print i
"""
for i in range(0,11,2):# 开始数 结束数 每次递增的步长
print i
#while
i=0
while i<10:
print(i)
i=i+1
#while is jiecheng
n=20
fact =1
i=2
while i<n:
fact=fact*i
i=i+1
print "number:"+str(fact)
python:for while
最新推荐文章于 2025-03-15 00:45:00 发布
本文通过几个简单的Python代码示例介绍了条件语句if、循环语句for和while的应用,并展示了如何使用这些语句来实现基本的功能,例如判断输入的名字并打印相应的年龄或者计算阶乘。
1846

被折叠的 条评论
为什么被折叠?



