for循环

Python笔记本
484 0

代码

chinese_zodiac = '猴鸡狗猪鼠牛虎兔龙蛇马羊'

#遍历字符串
for cz in chinese_zodiac:
    print(cz)

for i in range(1,13):
    print(i)

for year in range(2000,2019):
    print('%s 的生肖是 %s' %(year, chinese_zodiac[year % 12]))
    

演示

....

....

最后更新 2019-09-06
评论 ( 0 )
评论已关闭