Python - Playing With Numbers — Part 1

nijanthan
2 min readOct 24, 2021

Number rules the universe

Photo by Tim Evans on Unsplash

Introduction

Our daily lives move along with the time(number). we are hardly working for numbers. If you eat how much food you take is number. If you drink how many liters is number. For traveling, we will notice a kilometer(number). We revolve around the numbers. Think about this, what will happen if numbers were not invented?

Numbers rule’s the world. let us see How to control numbers using python.

Numeric Data types:

There are three built-in data types in python

  1. int
  2. float
  3. complex number

Can you hear about operators? Do you know names of the operators provided by python?

lets we see that Below are the important type of operators:

  • Arithmetic operators
  • Comparison Operators
  • Logical Operators
  • Assignment Operators

Arithmetic Operators

We can add, subtract, multiply, divide the numbers using python as a calculator. 😬 Oops, python is better than a calculator. Below are some examples.

Arithmetic operators

Comparison Operators

Comparison operators compares the values. It returns Boolean Value according to the condition.

Comparison Operators

Logical Operators

Logical AND, Logical OR, and Logical NOT operations are done by Logical operators. It is used to combine conditional statements.

Logical Operators

Assignment Operators

Assignment Operators

Type casting in python:

Python typecasting is divided into two types

  1. Implicit Type Casting:

Python automatically chooses the datatype of the output.

2. Explicit Type Casting:

Users can get the desired datatype as output using this typecasting.

Python uses its classes to define its datatypes. We can do apply type casting using the constructor function of classes.

  1. int()
  2. float()
  3. str()

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

nijanthan
nijanthan

Written by nijanthan

Full stack developer, Tech addict

No responses yet

Write a response