Skip to content

Instantly share code, notes, and snippets.

@orjanv
Created January 10, 2024 20:45
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 orjanv/199afb39f0e94ea8cda9d75f2c01af4b to your computer and use it in GitHub Desktop.
Save orjanv/199afb39f0e94ea8cda9d75f2c01af4b to your computer and use it in GitHub Desktop.
Kode for å telle femsifrede palindrome hentekoder
palindromer = []
for tall in range(00000,99999+1):
sjekk = f'{tall:05}'
if sjekk == ''.join(list(reversed(sjekk))):
palindromer.append(tall)
print(f'For et femsifret tall, er det {len(palindromer)} palindromer')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment