GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.geeksforgeeks.org — Python Numbers - GeeksforGeeks Python NumbersLast Updated : 27 May, 2026 Numbers are used to store numeric values and perform mathematical operations such as addition, subtraction, multiplication and division. Python provides different numeric data types to work with whole numbers, decimal values and complex numbers.
Output <class 'int'> <class 'float'> <class 'complex'> Types of NumbersPython mainly supports the following number types: 1. IntegerAn integer (int) represents whole numbers without decimal values. Integers can be positive, negative or zero. Python allows storing very large integer values without any fixed size limit.
Arithmetic Operations on IntegersPython supports different arithmetic operations on integer values such as addition, subtraction, multiplication and division.
Output 8 6 42 3.75 3 8 10 3.14 2. FloatA float (float) represents numbers with decimal values. Float numbers can be positive, negative or zero. They are commonly used when more precise numeric values are needed, such as measurements or calculations involving decimals.
Arithmetic Operations on FloatPython supports different arithmetic operations on float values similar to integers.
Output 5.7 3.5 11.0 2.0 2.0 0.0 6.25 7.4 3.14
3. Complex NumbersA complex number (complex) consists of two parts: Real part and Imaginary part. The imaginary part is represented using j. Complex numbers are commonly used in scientific and mathematical calculations.
Here, 2 is the real part and 3j is the imaginary part. Arithmetic Operations on Complex NumbersPython supports different arithmetic operations on complex numbers.
Output (4+6j) (3+3j) (-10+11j) (2.6153846153846154-0.9230769230769231j) 2j 5.0 (3-4j) 3.0 4.0
Random NumbersPython provides the random module to generate random numbers. Random values are useful in applications such as games, simulations, password generation and testing.
Output 29 3.8144379848390937
Special NumbersPython provides special numeric values that are used in scientific calculations and situations where normal numbers cannot represent a result.
Output nan inf -inf Comment Explore |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |