(Oct-04-2017, 05:19 PM)nomoremrriceguy Wrote: I want to get the power of any number from 1-8 what would I put in the pow ( )? I was thinking x or str(x) or just something that is variablex should be a integer,so then you need to convert input to
int()
.x is not a good name.
base_vaule = int(input("Enter Base Value: "))Inside function a loop:
>>> base_value = 3 >>> for n in range(1, 9): ... print(base_value ** n) 3 9 27 81 243 729 2187 6561So base_value is outside function,you give it as a argument to the function
my_pow(base_value):
.my_
is used so it don't overwrite build in pow()
.