Informatics Practices

Give the output of the following when num1 = 4, num2 = 3, num3 = 2.

num1 = num1 ** (num2 + num3)
print (num1)

Python Control Flow

4 Likes

Answer

1024

Working

In the given code, num1 = num1 ** (num2 + num3) calculates the result of raising num1 to the power of the sum of num2 and num3. The expression becomes 4 ** (3 + 2), which simplifies to 4 ** 5. Evaluating 4 ** 5 results in 1024, so the output of print(num1) is 1024.

Answered By

1 Like


Related Questions