Liam W
0
Q:

and in 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
Operator:		and
Syntax:			x and y
Description:	True if both the operands are true

# Examples of Logical Operator 
a = True
b = False
  
# Print a and b 
print(a and b) # False 
3
# Syntax for Boolean expression with or in Python
exp1 or exp2
6
#And opreator in python

a = 12
b = 56

print(a and b * 12)
1
x = 10
y = 12

# Output: x > y is False
print('x > y is',x>y)

# Output: x < y is True
print('x < y is',x<y)

# Output: x == y is False
print('x == y is',x==y)

# Output: x != y is True
print('x != y is',x!=y)

# Output: x >= y is False
print('x >= y is',x>=y)

# Output: x <= y is True
print('x <= y is',x<=y)
1
% : Modulus - remainder of the division of left operand by the right
  	x % y (remainder of x/y)
2
//	'a' // 'b'	(Floor Division) Quotient when 'a' is divided by 'b', rounded to the next smallest whole number
5
# 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
#Performs floor-division on the values on either side. Then assigns it to the expression on the left.
>>> a=6
>>> a//=3
>>> print(a)
2
0

New to Communities?

Join the community