Home > Article > Backend Development > What is the operation symbol of % in python?
In python, "%" is an arithmetic operation symbol, which means to find remainder or modulus and return the remainder of division. For example, "a=5, b=3", the value of "a%b" is 2, take the remainder of dividing a by b.
The operating environment of this tutorial: windows7 system, python3 version, Dell G3 computer.
Find remainder/modulo, return the remainder of division, such as a=5, b=3, a%b=2; take the remainder of dividing a by b
#!/usr/bin/python # -*- coding: UTF-8 -*- a = 21 b = 10 c = 0 c = a % b print "5 - c 的值为:", c
The result is:
5 - c 的值为: 1
Extended information:
arithmetic operators
Related free learning recommendations:python video tutorial !
The above is the detailed content of What is the operation symbol of % in python?. For more information, please follow other related articles on the PHP Chinese website!