logo CodeStepByStep logo


Language/Type: Python math parameters

Write a function named print_powers_of_n that accepts a base and exponent as parameters and prints each power of the base from base0 (1) up to that maximum power, inclusive, separated by spaces. For example, the call of print_powers_of_n(5, 6) should produce the following output:

1 5 25 125 625 3125 15625

You may assume that the exponent passed is 0 or greater.

Function: Write a Python function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.