0
#Error in return code
Sorry this is a noob one https://code.sololearn.com/cbY9DvQ7iIZy/?ref=app
5 Answers
+ 4
mdhbl , you need to use print() outside of your function call.
...
print(Power (9, 2))
print(Power (9, 1))
+ 2
You are getting no output because you have not printed it!! I mean return means to return a value , and for see the output you need the help of print() function.
here is the code - https://code.sololearn.com/cUW6kdZuWDaR/?ref=app
+ 2
Para ver el resultado primero debes usar la función print(), a continuación te brindó 2 pequeños ejemplo de cómo seria:
#option 1
def Power(number, pow=1):
"""Raise num to the power of pow"""
new_value=number ** pow
print(new_value)
Power (9, 2)
Power (9, 1)
#option 2
def Power(number, pow=1):
"""Raise num to the power of pow"""
new_value=number ** pow
return new_value
print(Power (9, 2))
print(Power (9, 1))
+ 1
If you just try to rectify your last two steps by making it a print command, it will give a damn good output!
print(Power(9,2))
print(Power(9,1))
Boom, you are good to go!
0
Thanks everyone.