Skip to content

The "Operators in Python" repository showcases various Python operators, including arithmetic, logical, comparison, and assignment operators. Each operator is demonstrated with examples, providing a clear understanding of their functionality and how they can be applied in real-world coding scenarios.

Notifications You must be signed in to change notification settings

imDarshanGK/Operators

Repository files navigation

Operators in Python ➗➕✖️

Overview

This repository contains Python programs demonstrating various operators. It covers arithmetic, comparison, logical, and assignment operators, with examples for each.

Features

  • Examples of different types of operators in Python.
  • Clear explanations and practical code snippets.
  • Demonstrates how to use operators in real-world scenarios.

Arithmetic operators

An arithmetic operator is a mathematical function that performs a calculation on two operands

solution:
Arithmetic operators
    
Add = 77
Sub = 13
Mul = 1440
Div = 1.40625
Mod = 13
Exp = 79946681398258369524447459012293256819248199462890625
F.D = 1
Left shift
40
  
Bitwise NOT(~)
-11
 9

Bitwise OR
236

Logical operators

There are used to compare two relational expressions, after comparison it gives True or False.

True
False
False
False
True
True
True
False
False
True

Assignment Operators

In fix which are used to perform operations on variables or operands and assign values to the operand on the leftside of the operator.

a= 40
a+= 80
a-= 40
a*= 1600
a/= 40.0
a%= 0.0
a//= 0.0

Relational operators

It is used to compare the two operands and it returns true or false.

True
False
True
False
True
True
False

Right shift and Left shift

1} Bitwise Right Shift Operator
The bitwise right shift operator in python shifts the bits of the binary representation of the input number to the right side by a specified number of places. The empty bits created by shifting the bits are filled by 0s.

2} Bitwise Left Shift Operator
The bitwise left shift operator in Python shifts the bits of the binary representation of the input number to the left side by a specified number of places. The empty bits created by shifting the bits are filled by 0s.  

Right shift
    Right shift is: 1

Left shift
    Left shift is: 48

About

The "Operators in Python" repository showcases various Python operators, including arithmetic, logical, comparison, and assignment operators. Each operator is demonstrated with examples, providing a clear understanding of their functionality and how they can be applied in real-world coding scenarios.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages