def power(base, exp): if (exp == 1): return (base) if (exp != 1): return (base * power(base, exp - 1)) base = int(input("Enter base: ")) exp = int(input("Enter exponential value: ")) print("Result:", power(base, exp))
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter