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()
return result SyntaxError: 'return' outside function
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started