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.