Python Course Guide
  • Introduction to Python
  • Guides
    • Course Outline
    • Getting started with Python
    • Syntax
    • Variables
    • Datatypes
    • Casting
    • Numbers
    • Operators
      • Python Math
    • Strings
    • Python String Formatting
    • User Input
    • Git and Github
    • Booleans
    • List
    • Tuples
    • Sets
    • Dictionaries
    • Conditionals
    • Loops
    • Function
    • Arrays
    • Try and Except
    • Scope
    • Classes and Objects
    • Class Methods and Properties
    • Inheritance
    • Polymorphism
    • Dunder Methods(Double Underscore Methods)
    • Decorators
    • Iterator and Generator
    • Modules and Packages
    • Date and Time
    • JSON
    • RegEx
    • Pip
    • File Handling
    • Data Structures and Alogrithms
    • References
Powered by GitBook
On this page
  1. Guides

Numbers

Python Numbers

There are three numeric types in Python:

  • int

  • float

  • complex

Variables of numeric types are created when you assign a value to them:

Example

x = 1 # int y = 2.8 # float z = 1j # complex

To verify the type of any object in Python, use the type() function:

Example

print(type(x)) print(type(y)) print(type(z))

PreviousCastingNextOperators

Last updated 2 years ago