DEV Community

Ranjith srt
Ranjith srt

Posted on

5.Operators, Conditionals, input()

*arithmetic operators *

The six arithmetic operators in Python are: addition (+), subtraction (-), multiplication (), division (/), modulo (%), and exponentiation (*). These operators allow you to perform mathematical operations on numeric data types such as integers and floating-point numbers.

*comparison operators *

Comparison operators are used to compare two values:

==, !=, <=, >=, >, <.

Logical Operators..

Python logical operators are used to combine conditional statements, allowing you to perform operations based on multiple conditions.
and, or, not

Assignment Operators

Assignment operators are used to assign values to variables:

, +=, /=, *=, -=

Conditionals

Used to execute a block of code only if a specified condition is true.

if condition:
code block

Used to execute a block of code if the condition in the if statement is false.

`if condition:
code block

Else:

code block

`

Short for "else if", used to check multiple conditions.

`if condition:

Elif :

Else:
--`
input

Age=int (input ("Enter your age" ))

Input from input() is always a string; convert it using functions like int(), float(), str().

BODMAS

Brackets (Parentheses ()): Operations inside brackets are performed first.
Orders (Exponentiation **): Next, orders (exponents and roots).
Division and Multiplication (/, *, //, %): From left to right. • Addition and Subtraction (+, -): From left to right.

Task:
Image description
Playlist:

https://youtube.com/playlist?list=PLiutOxBS1Mizte0ehfMrRKHSIQcCImwHL&si=pKTi0wvSUvbXfwUS

Top comments (0)