Skip to content

Instantly share code, notes, and snippets.

@AnnikaNoren
Created November 2, 2020 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AnnikaNoren/349fecdf5a427546d6cc1bc634013e35 to your computer and use it in GitHub Desktop.
Save AnnikaNoren/349fecdf5a427546d6cc1bc634013e35 to your computer and use it in GitHub Desktop.
def disarm(num):
num_str = str(num)
count = len(num_str)
temp = 0
for i in range(0, count):
temp += int(num_str[i]) ** int((i+1))
if temp == num:
print("The number", num, "is a disarmuim")
else:
print("Sorry, the number ", num, "is not a disarmium")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment