[Tutor] Calculate 4**9 without using **

Sri Kavi gvmcmt at gmail.com
Sat Mar 4 11:17:29 EST 2017


Hi,


I'm a beginner learning to program with Python. I'm trying to explain a
solution in plain English. Please correct me if I'm wrong.


Create a function that takes base and exponent as arguments.



In the body of the function:

set a result variable to the base.



User a for-loop with a range of 1 to the exponent.

With each iteration, set the result to the product of result times base.



After the loop, return the result.



Call the function.





Regards
Sri


More information about the Tutor mailing list