Saturday, September 30, 2023

Operators in Python

 operators :-

Arithmetic Operators:-  +,-,/,*,%,//,**

Comparison Operators :- <,>,>=,<=,!=,==

Logical Operators :- and, or, not

Bitwise Operators:- 

Assignment Operators:- *=,-=,+=,/=,//=,**=,

Identity Operators:- is, is not 

Membership Operators :- in , not in 


identity operators:-

a=10

b=20

print(a is b)  # false

print(a is not b)  #true 


membership operators :-

a = [1,2,3,4,5]

b=2

c=12

print(b in a)  # true

print(c not in a)  # true 

No comments:

Post a Comment

virtual environment on python on Ubuntu

 # 1. Update system and install Python tools sudo apt update && sudo apt install python3-pip python3-venv -y # 2. Setup Django in a ...