09、循环语句

2019-11-30  本文已影响0人  hnssyg

# 记录生肖,根据年份来判断生肖

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

for cz in chinese_zodiac:

    print(cz)

for i in range(1,13):

    print(i)

for year in range(2000,2020):

    print('%s 年的生肖是 %s' %(year,chinese_zodiac[year %12]))


num =5

while True:

print('a')

num = num +1

    if num >10:

break


import time

num =5

while True:

num = num +1

    if num ==10:

continue

    print(num)

time.sleep(1)

上一篇下一篇

猜你喜欢

热点阅读