embedded system,Arduino,Raspberry pi,ARM7,MM32,STM32,PIC and Python,Django,Datascience and web development
Monday, April 5, 2021
operators in python
"""
Created on Mon Apr 5 21:18:07 2021
@author: Onyx1
#class-3-05-04-2021
#addition
a=10
b=20
print(a+b)
#substraction
print(b-a)
print(a-b)
#multiplication
print(a*b)
#division
print(a/b)
#floor division
print(a//b)
#power
print(a**b)
#python 2.x
print("anl")
#operators
#arthimatic operation
#assignment operators
#logical operators
#conditional
#identify
#membership
#bitwise
#arthimatic operation
# +,-,*,/,%,//,**---> operators
#assignment operators
a=10
b=20
a=a+b
b=b-a
a=a*b
print(a)
b=30+50
print("b-",b)
a=20
b=10
a=a/b
print(a)
a=20
b=10
a=a//b
print(a)
a=20
b=10
a=a**b
print(a)
#logical operators
#& | !
#and
a=4#0100
b=2#0010
a = a & b
print(a)
a=10#1010
b=8#1000
a = a & b
print(a)
a=4 #0100
b=2 #0010
harish=a|b #0110--6
print(harish)
#not....not available
a=2 #0010
a!=3 #0011
print(a)
#conditional operator
a=5
a==5
#5==5
if (a==5):
print("this is harish")
a>5 #comparison greater than
a<4 #comparison less than
a<=5 #less than or equal to
a>=10 # greater than or equal to
a!=10 #not equal to
#identify
#is
#is not
#is if two values true then return True same object
#is not if two value not True then return False same object
x=["rose","lilli"]
b=["rose","lilli"]
a=x
#print(a,x)
#print(id(a),id(x))
#print(b,id(b))
print(x is a) #true
print(x is b) #False
print(x is not b)#True
print(x is not a)#false
"""
#membership
#in
#not in
x=["rose","lilli"]
print("rose" in x) #if member exist ---true
print("chicken" not in x ) #not exist ---true
print("lilli" not in x ) #false
Subscribe to:
Posts (Atom)
-
How to do the programming python in windows command prompt Step 1: please go through below link website f...
-
Serial.print() Description Prints data to the serial port as human-readable ASCII text. This command can take many forms. Numbers a...