Skip to content

Instantly share code, notes, and snippets.

@CodeByAidan
Created October 31, 2022 13:00
Show Gist options
  • Save CodeByAidan/100056e11370fcd3ec4c05a42456588f to your computer and use it in GitHub Desktop.
Save CodeByAidan/100056e11370fcd3ec4c05a42456588f to your computer and use it in GitHub Desktop.
Power Function Calculator - super simple
try:
# Take the base value from the user
x = int(input("Enter the base value: "))
# Take the power value from the user
n = int(input("Enter the power value: "))
# Print the result
print("%d to the power %d = %f" % (x, n, pow(x, n)))
# Print the remainder value
print("The remainder value = ", pow(x, n, 5))
except:
# Print the error message
print("Error exists in the script.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment