CIT PYTHON COHORT THREE
  • CIT Python Cloud Software Engineering
  • week one
    • What is Python
    • Python Syntax
    • variables
    • Numbers / Integers
  • week Two
    • Control Flow Statements
      • If Statements
      • For Loops
      • While Loops
      • Break and Continue Statements
    • Operators
      • Assignment Operators
      • Arithmetic Operators
      • Comparison Operators
      • Logical Operators
      • Bitwise Operators
      • Identity Operators
      • Membership Operators
    • Data Types
      • Strings
      • Numbers
      • Booleans
      • Lists
      • Dictionaries
      • Tuples
      • Sets
  • Week 3
    • Functions
      • Function Arguments
      • Python Recursion
      • Python Anonymous/Lambda Function
    • Object Oriented Programming
      • Classes
      • Inheritance
      • Polymorphism
      • Abstraction
      • Encapsulation
    • Python Modules
      • Python Packages
      • Python Built-in Modules
      • Python Standard Library
      • Python Third Party Modules
    • Python Exceptions
      • Python Try Except
      • Python Raise
      • Python Assert
      • Python User-defined Exceptions
  • Week 4 - File Handling
  • Week6
    • Data Structures and Algorithms
      • DSA Introduction
      • What is an Algorithm?
      • Data Structures and Types
      • Stack
      • Queue
      • Linked List
      • Bubble Sort Algorithm
      • Selection Sort Algorithm
      • Insertion Sort Algorithm
      • Merge Sort Algorithm
      • Quick Sort Algorithm
  • Week8
    • Cryptography
      • Reverse Cipher
      • Caesar Cipher
      • Hash Functions
        • Applications of Hash Functions
        • Examples of Hash Functions
  • Assignments and Solutions
    • Loops
Powered by GitBook
On this page
  • Integers (int)
  • Boolean (bool)
  • Float (float)
  • References

Was this helpful?

Edit on GitHub
  1. week one

Numbers / Integers

Numbers are the foundation of every programming language. In this module, we will learn how to use numbers in Python.

There are three numeric types in Python:

  • int (e.g. 2, 4, 20)

    • bool (e.g. False and True, acting like 0 and 1)

  • float (e.g. 5.0, 1.6)

  • complex (e.g. 5+6j, 4-3j)

Integers (int)

  • int is a whole number, without decimals, of unlimited length. e.g. 2, -2, 0, -0, 2147483647, -2147483648

positive_int = 2
negative_int = -2
zero = 0

Boolean (bool)

Booleans represent the truth values False and True. The two objects representing the values False and True are the only Boolean objects.

The Boolean type is a subtype of the integer type, and Boolean values behave like the values 0 and 1, respectively, in almost all contexts, the exception being that when converted to a string, the strings "False" or "True" are returned, respectively. example:

is_raining = True
is_cloudy = False

Float (float)

Float, or "floating point number" is a number, positive or negative containing one or more decimals. Example:

float_number = 7.0
# Another way of declaring float is using float() function.
float_number_via_function = float(7)
float_negative = -35.59

References

PreviousvariablesNextweek Two

Last updated 11 days ago

Was this helpful?

Python Documentation
W3Schools