""" 题目:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少? 1 1 2 3 5 8 13 就是斐波那契数列 直接查看example006 """ Read More
posted @ 2017-12-18 17:45 longphui Views(156) Comments(0) Diggs(0) Edit
""" 题目:暂停一秒输出,并格式化当前时间。 """ import sys import time def answer1(): """ 每隔一秒刷新一下时间 Print是比较多用到的函数,但是很多人对它的详细用法还不是很清楚,今天我们就来一探庐山真面目,详解print的前世今生。 print在Python2.x时代不是一个函数,只是一个关键字... Read More
posted @ 2017-12-18 17:02 longphui Views(324) Comments(0) Diggs(0) Edit
""" 题目:暂停一秒输出。 程序分析:使用 time 模块的 sleep() 函数。 http://www.runoob.com/python/python-date-time.html Python 中提供了对时间日期的多种多样的处理方式,主要是在 time 和 datetime 这两个模块里。今天稍微梳理一下这两个模块在使用上的一些区别和联系。 time 在 Python 文档里,tim... Read More
posted @ 2017-12-18 11:11 longphui Views(219) Comments(0) Diggs(0) Edit
""" 题目:输出 9*9 乘法口诀表。 """ def answer1(): """ 自己用最普通的双重循环来输出 :return: """ print("输出一:") for i in range(1, 10): for j in range(1, i + 1): print("%d x %d =%2... Read More
posted @ 2017-12-18 09:57 longphui Views(124) Comments(0) Diggs(0) Edit