Dec-08-2019, 06:27 AM
(This post was last modified: Dec-08-2019, 06:35 AM by zeclipse21.)
This is supposed to be the outcome of my code
Output:Enter your choice: 3
Enter the value of the base followed by the exponent: 5 3
The power of 5 raised to 3 is 125.
my code isn,exp=int(input("Enter the value of the base:")).split(",") def power(n,exp): if(exp==1): return(n) if(exp!=1): return(n*power(n,exp-1)) print("The power of",n, "raised to",exp,"is",power(n,exp))This is the error i receive
Error:Traceback (most recent call last):
File "C:\Users\NICKLAUS\Desktop\LE3222_RosalesNicklaus.py", line 1, in <module>
n,exp=int(input("Enter the value of the base:")).split(",")
ValueError: invalid literal for int() with base 10: '3,5'