gREFER
0
Q:

operators in python

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
# 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
#python exponent operator
num = 2
new_num = num**2
#answer would be 4
2
//	'a' // 'b'	(Floor Division) Quotient when 'a' is divided by 'b', rounded to the next smallest whole number
5
# Below follow the math operators that can be used in python
# ** Exponent	
2 ** 3 # Output: 8
# % Modulus/Remaider	
22 % 8 # Output: 6
# // Integer division	
22 // 8 # Output: 2
# / Division	
22 / 8 # Output: 2.75
# * Multiplication	
3 * 3 # Output: 9
# - Subtraction	
5 - 2 # Output: 3
# + Addition	
2 + 2 # Output: 4
1
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