Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

**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()

image text in transcribed

return result SyntaxError: 'return' outside function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago