Python learning by case study@[April]
(跟着April用真实案例学Python)
Lesson two 第二讲
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–“PRINT( .format())”
As you known from lesson one, we could not directly print two variables together if these two belong to different data formats.
从第一课中知道,不能直接将不同类型的数字结构相加后打印输出。
Today, we will learn print( .format()), to overcome the problem above.
今天我们学习print( .format())来解决上面的问题。
First, look at the following code:
首先,看下下面的代码:
The output of the code is below:
运行结果如下:
Second, inside format, you could directly calculate the number.
在format里面,数字可以直接计算。
look at the following code:
看下下面的代码:
The output of the code is below:
运行结果如下:
So, you have learnt python ‘print( .format())’ in today’s lesson. See you next time.
今天,这节课里你学会了用print( .format())。下节课再见啦~