Question: **Please revise the python code below. An error results on line 9 as seen below. Input function CANNOT be used.** 4.3 Write a program and

**Please revise the python code below. An error results on line 9 as seen below. Input function CANNOT be used.**

4.3 Write a program and create a function called powRand that generates two random integer numbers(base and exponent) which are between 1 and 10. The function calculates the base power exponent using math.pow function and returns the result. The program output is shown below.

Input:

a) python C:\Users eda\DataProgramming\M4\assign4-3.py

b) python C:\Users eda\DataProgramming\M4\assign4-3.py

Output:

a) 5 power 9 is 1953125

b) 6 power 4 is 1296

Code:

import random import math

def powRand(): a = random.randint(1, 10) b = random.randint(1, 10) result = math.pow(a, b) print(a, "power", b, "is", int(result)) return result powRand()

**Please revise the python code below. An error results on line 9

return result SyntaxError: 'return' outside function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!