id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

david.white@denison.edu cs112fall2015 > power
prev  |  next  |  chance

Write a function power(base, exponent) that returns the value base^exponent, i.e. base * base * base * ... * base, where there are exponent many terms of the product. For example, 2^5 = 32 because 2*2*2*2*2 = 32. Do not assume base and exponent are integers. Raising a number to the power 1/2 is the same as taking its square root.


power(2, 3) → 8
power(4, 0.5) → 2.0
power(4, 0) → 1

...Save, Compile, Run (ctrl-enter)

def power(base, exponent):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Copyright Nick Parlante 2017 - privacy