Python study note Day 1
After the ‘print’ statement, I gonna study the operators and variables.
There are some operators when we use Python to write a project.
Like
+
-
*
**
/
//
%
and so on.
OPERATORS


In these two pictures, we can see it clearly that the different operators has different ways to use. By the way, the operator ‘%’ means remainder after division and the operator ‘/’ means division and the quotient is a floating point number.
And, opposite the operator ‘%’ means MOD, the operator ‘//’ means INT
VARIABLES
Here’s a new concept we need to study named variable.
It can be seemed as a container contains the int,float,string and something else.
And the variable even can be expressed as a formula consisting of variables.
I will show some examples about different kinds of the methods to use the variable to output some message.

The double quotation marks in the use of the ‘print’ statement indicate the output of the string.
Obviously, in this screen shot, there are different results whether to use double quotation marks.

In this picture, I’ve shown another method to use the variable.
The variable can be used to be expressed as a formula consisting of other variables. And the difference between these two ways to output is the problem about whether to change to a newline.

Maybe there are some floating point numbers and some strings of the codes need to be output, we can set a variable to represent these things.
At the end of the picture, we can see it clearly that what the double quotation marks ways to use.
这篇博客主要介绍了Python中的运算符,包括加减乘除、取余和整除等,并解释了它们的区别。此外,还讲解了变量的概念,将其比喻为储存各种类型数据的容器,可以是整数、浮点数、字符串等。文中通过实例展示了如何使用变量输出信息,并探讨了双引号在打印语句中不同用法的影响。最后,提到了变量在表达式中的运用以及换行输出的差异。
6517

被折叠的 条评论
为什么被折叠?



