龙空技术网

畅享聊:Python的练习题(4)

LearningYard学苑 186

前言:

如今小伙伴们对“菜鸟教程python100题”大体比较关注,大家都想要分析一些“菜鸟教程python100题”的相关文章。那么小编也在网络上收集了一些关于“菜鸟教程python100题””的相关文章,希望各位老铁们能喜欢,小伙伴们一起来了解一下吧!

分享兴趣,传播快乐,增长见闻,留下美好!

亲爱的您,这里是LearningYard新学苑。

今天小编为你带来

畅享聊:Python的练习题(4)

欢迎您的访问!

Share interests, spread happiness, increase knowledge, and leave beautiful!

Dear you, this is LearningYard Academy.

Today, the editor brings you

Enjoy chatting:Python Exercises (4)

welcome your visit!

哈喽,大家好!今天还是小编继续带着大家做一做Python的相关练习题,道道都是经典。

Hello, everyone! Today, I will continue to take you to do Python related exercises, which are all classics.

题目:输出 9*9 乘法口诀表。

程序分析:分行与列考虑,共9行9列,i控制行,j控制列。

Topic: Output 9 * 9 multiplication table.

Program analysis: considering branches and columns, 9 rows and 9 columns in total, i control row and j control column.

程序源代码:

Program source code:

输出结果如下:

The output results are as follows:

题目:暂停一秒输出。

程序分析:使用 time 模块的 sleep() 函数。

程序源代码:

Topic: Pause output for one second.

Program analysis: use the sleep () function of the time module.

Program source code:

输出结果如下:

The output results are as follows:

注:1a,2b,3c之间会间隔一秒输出。

题目:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少?

程序分析:兔子的规律为数列1,1,2,3,5,8,13,21....

程序源代码:

Note: 1a, 2b, 3c will be output every one second.

Title: Classical question: There is a pair of rabbits. From the third month after birth, a pair of rabbits will be born every month. When the rabbits grow to the third month, another pair of rabbits will be born every month. If the rabbits do not die, what is the total number of rabbits in each month?

Program analysis: the rule of rabbits is sequence 1, 1, 2, 3, 5, 8, 13, 21

Program source code:

输出结果如下:

The output results are as follows:

今天的分享就到这里了。

如果您对今天的文章有独特的想法,

欢迎给我们留言,

让我们相约明天,

祝您今天过得开心快乐!

That's it for today's sharing.

If you have a unique idea about today’s article,

Welcome to leave us a message,

Let us meet tomorrow,

I wish you a happy day today!

本文由learningyard新学苑原创,如有侵权,请联系我们。

参考资料:Python菜鸟教程

翻译来源:百度翻译

文字&排版|calm

审核|闫庆红

标签: #菜鸟教程python100题