'''
我爱拉芳·无尽版
·永无休止地输出“我爱XX”一直到死
·每隔一秒输出“我爱XX”一直到死
'''
import time

count = 0

# 条件表达式永远成立,永远循环执行
while True:
    count += 1
    print("我爱拉芳*%d" % (count))
    time.sleep(1)  # 睡眠1秒

'''
我爱拉芳·百年版
·输入一个人的名字,将“我爱XX”输出100遍
·使用while循环做
'''
import time

count = 0

# 当count<100时执行循环,否则结束循环
while count < 10:
    count += 1
    print("我爱拉芳*%d" % (count))
    time.sleep(1)

# 只有循环结束才能执行到这里
print("终于结束了,可以爱别人了!耶~")

results matching ""

    No results matching ""