Created
January 10, 2024 20:45
-
-
Save orjanv/199afb39f0e94ea8cda9d75f2c01af4b to your computer and use it in GitHub Desktop.
Kode for å telle femsifrede palindrome hentekoder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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