Python 练习实例75
题目:放松一下,算一道简单的题目。
程序分析:无。
实例
#!/usr/bin/python# -*- coding: UTF-8 -*-if__name__ == '__main__':
foriinrange(5):
n = 0ifi != 1: n += 1ifi == 3: n += 1ifi == 4: n += 1ifi != 4: n += 1ifn == 3: print64 + i
以上实例输出结果为:
67
题目:放松一下,算一道简单的题目。
程序分析:无。
以上实例输出结果为:
67
yanice
672***[email protected]
判断情人节:
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import time
if __name__=='__main__':
date=time.strftime('%m-%d',time.localtime())
if date=='02-14':
print '情人节是时候给你女朋友买支玫瑰花了!!'
else:
print '这时候你不要忘记发个红包!!'
print '哈哈,这是一个测试题!!'yanice
672***[email protected]