Python 练习实例75
题目:放松一下,算一道简单的题目。
程序分析:无。
实例
#!/usr/bin/python
# -*- coding: UTF-8 -*-
if __name__ == '__main__':
for i in range(5):
n = 0
if i != 1: n += 1
if i == 3: n += 1
if i == 4: n += 1
if i != 4: n += 1
if n == 3: print 64 + i
以上实例输出结果为:
67
题目:放松一下,算一道简单的题目。
程序分析:无。
以上实例输出结果为:
67
yanice
672***617@qq.com
判断情人节:
#!/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***617@qq.com