Q:

logical operators python

# Python Operators
Operator	Name			Example
+			Addition		x + y	
-			Subtraction		x - y	
*			Multiplication	x * y	
/			Division		x / y	
%			Modulus			x % y	
**			Exponentiation	x ** y	
//			Floor division	x // y
17
# operations in numbers with python 
a = 15
b = 3
#a and b are not expression because they are at the right side

print(a + b)    # this will add the numbers
print(a - b)    # this will subtract the numbers
print(a * b)    # this will multiply the numbers
print(a / b)    #this will divide the numbers
print(a // b)   #this will gives the reminder after division
2
Python uses and and or conditionals.

i.e.

if foo == 'abc' and bar == 'bac' or zoo == '123':
  # do something
0
x + y = 19
x - y = 11
x * y = 60
x / y = 3.75
x // y = 3
x ** y = 50625
0
# logical and operator
# return first operands if false otherwise second operands

0 and 3
# output = 0
3 and 0 
# output = 0
3 and 5 
# output = 5
1

New to Communities?

Join the community