minte9
LearnRemember / PYTHON



Operators

 
""" The + operator concatenates two strings
    The * operator performs repetitions on strings
"""

a = 'Hello'
b = 'World'

print(a + ' ' + b) 
print(a * 3) 

"""
    Hello World
    HelloHelloHello
"""

Exponential

 
n = 6**2 + 6

print(n)  # 42

Bitwise

 
n = 6^2  # XOR

print(n)  # 4

Division

 
n = 105 / 60

print(n)  # 1.75

Floor Division

 
minutes = 105
hours = minutes // 60

remainder = minutes - hours*60
print(remainder)  # 45






Questions and answers




Exponential operator in Python

  • a) 6^2
  • b) 6**2

Divede two numbers and round down

  • a) 150 % 60
  • b) 150 // 60


References





Connected Graph