Home > Backend Development > Python Tutorial > What is the operation symbol of % in python?

What is the operation symbol of % in python?

醉折花枝作酒筹
Release: 2023-01-06 11:18:16
Original
85926 people have browsed it

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.

What is the operation symbol of % in python?

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
Copy after login

The result is:

5 - c 的值为: 1
Copy after login

Extended information:

arithmetic operators

What is the operation symbol of % in python?

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template