Arithmetic operators in python

Reference link: Division operator in Python

Arithmetic operator is a kind of operator, generally used to deal with four arithmetic operations.

/ Divide by 10/20 = 0.5

// Round and divide return the integer part of the division (quotient) 9 // 2 outputs the result 4

% Take the remainder Return the remainder of the division 9% 2 = 1

**Power is also called power, power, 2 ** 3 = 8

In addition: In Python, the * operator can also be used for strings, and the calculation result is the result of repeating the string a specified number of times

print("+"*20)

console:+++++++++++++++++++

Consistent with the precedence of operators in mathematics, the same is true when performing mathematical calculations in Python:

Multiplication and division followed by addition and subtraction. Operators of the same level are calculated from left to right. You can use () to adjust the priority of calculation. The following shows that the arithmetic priority is arranged in order from highest to lowest:

the first: **

Second: *, /, %, //

Third: +,-

E.g:

2 + 3 * 5 = 17

(2 + 3) * 5 = 25

2 * 3 + 5 = 11

2 * (3 + 5) = 16

How can there be less joy in programming:

My wife said diligently: "My husband, what time do I get off work, miss you!" Husband: "Talk about business!" Wife: "I saw a package online

The bag, this year's new style, is particularly beautiful, and it is still limited. "Husband: "Talk about the point!" "Wife:" It's just a bit expensive, it costs one thousand and eight. "old

Gong: "This is not the point!" Wife: "Send the bank verification code you just received on your phone."

ok, the arithmetic operators in Python are gone here, ^_^o!

Recommended Posts

Arithmetic operators in python
03. Operators in Python entry
Functions in python
Python basic operators
12. Network Programming in Python3
print statement in python
Concurrent requests in Python
Install python in Ubuntu
Write gui in python
MongoDB usage in Python
Str string in Python
Computational Geometry in Python
Concurrent requests in Python (part 2)
Subscripts of tuples in Python
Noteworthy update points in Python 3.9
Containerize Python applications in 3 minutes
What is introspection in python
What is object-oriented in python
Generators and iterators in Python
Python arithmetic sequence calculation method
Talking about strings in Python
The usage of wheel in python
Summary of logarithm method in Python
Use of Pandas in Python development
Use nohup command instructions in python
What is list comprehension in python
Getting started with Numpy in Python
Detailed sorting algorithm (implemented in Python)
How to wrap in python code
Common errors and solutions in python
Use of numpy in Python development
What does def in python do
How to omit parentheses in Python
Detailed usage of dictionary in Python
Usage of os package in python
Learn about garbage collection in Python
How to write classes in python
How to filter numbers in python
​What are the numbers in Python?
How to read Excel in Python
There are several keywords in Python
Everything in Python is an object
How to view errors in python
What does np do in python
How to write return in python
Talking about the modules in Python
How to understand variables in Python
How to clear variables in python
The usage of tuples in python
How to use SQLite in Python
Description of in parameterization in python mysql
Understanding the meaning of rb in python
Is there an algorithm in python language
How to use and and or in Python
How to delete cache files in python
How to introduce third-party modules in Python
Implementation of JWT user authentication in python
How to represent null values in python
How to save text files in python
Write a Qixi confession artifact in Python
How to run id function in python