编程语言
首页 > 编程语言> > Python learning by case study@[April] (跟着April用真实案例学Python) Lesson six “for loop”循环

Python learning by case study@[April] (跟着April用真实案例学Python) Lesson six “for loop”循环

作者:互联网

Python learning by case study@[April]
(跟着April用真实案例学Python)

Lesson six 第六讲
Python is one of the most popular programming languages in the world. It is necessary to grasp it before entering the workplace.

Python是世界上最流行的编程语言之一。 在进入职场前大家都有必要掌握这门语言。

TODAY’S FOCUS–“for loop”
今日学习:for loop 循环 条件

First, if we want to print the following result, what can we do with for loop?
首先,看下下面的输出结果,我们应该怎么用循环语句?

1X1=1
1X2=2
1X3=3
1X4=4
1X5=5
1X6=6
1X7=7
1X8=8
1X9=9

The code is below, but there is a error inside, could you find it?
代码如下,但是里面有错误,你发现了吗?
case1-for loop
case1-for loop -output
You may notice that the ‘1X9=9’ did not show on the screen.
你也许注意到了,输出结果里少了1X9=9.

So, how to change the code?
那么应该如何更正代码呢?

case1-for loop
case1-for loop
Let’s have look at another example. The result is according to the user’s input number.
我们再看一个例子,这次是根据用户自己输入的数字,来确定计算到9乘以几。
case 2-for loop
case 2 for loop output
So, you have learnt python ‘for loop’ in today’s lesson. See you next time.
今天,这节课里你学会了python里的 ‘for loop’循环 。下节课再见啦
case3-for loop
在这里插入图片描述

标签:case,code,Python,April,循环,1X9,loop
来源: https://blog.csdn.net/weixin_43324107/article/details/95757497