How to define integers in python

anonymity
Release: 2019-06-20 10:15:07
Original
21458 people have browsed it

The Python number type includes the integer type, which is one of the immutable data types. Some of its properties are the same as strings.

How to define integers in python

Python int has multiple number types: int, long, bool, float, and complex.

Creation and declaration of integer type int

Creating a new integer type variable and assigning a value to the variable are the same process

a = 123 or b = -123 The left side of the equal sign is the variable name, and the right side is the value to be assigned. It's that simple.

Characteristics of integers

Since it is an integer, the data during natural assignment must be integers. Integers are simply understood as (positive integers and negative integers)

Arithmetic operators and methods between integer variables

The operators in front of integer data type variables that python can currently support are: addition (+), subtraction (-), multiplication (*), division (/) and power (**)

If you want to quote the result between two variables, remember to reassign the value before quoting.

The above is the detailed content of How to define integers 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!