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?
代码如下,但是里面有错误,你发现了吗?
You may notice that the ‘1X9=9’ did not show on the screen.
你也许注意到了,输出结果里少了1X9=9.
So, how to change the code?
那么应该如何更正代码呢?
Let’s have look at another example. The result is according to the user’s input number.
我们再看一个例子,这次是根据用户自己输入的数字,来确定计算到9乘以几。
So, you have learnt python ‘for loop’ in today’s lesson. See you next time.
今天,这节课里你学会了python里的 ‘for loop’循环 。下节课再见啦