''' Can you write a short piece of python code that raises a to the power b? | Now can you do the same using only arithmetic operators? | Now what if b was any positive real number? | And if you could not use math.pow ? ''' a = 2 b = 3 result = a ** b print(result) #arthimetic operators a = 2 b = 3 result = 1 # Multiply 'a' with itself 'b' number of times for i in range(b): result *= a print(result) #if b was any positive real number a = 2 b = 3.5 result = pow(a, b) print(result) #using math.pow a = 2 b = 3.5 if a == 0: result = 0 elif a < 0 and b % 1 == 0: result = -1 * (abs(a) ** b) else: sign = 1 if a > 0 else -1 result = sign * (abs(a) ** b) print(result)