Created
November 3, 2017 19:40
-
-
Save lrlucena/cfd009d2b50f36858a178577f96bc1bb to your computer and use it in GitHub Desktop.
Desafio 03 - Os Programadores
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
# Usando a linguagem Potigol: potigol.github.io | |
palindromos(min, max: Inteiro) = | |
para i de min até max se i.texto == i.texto.inverta gere i fim | |
testes = [(0, 20), (3000, 3010), (0, 1000), (1000, 2000), (2000, 3000)] | |
para teste em testes faça | |
min, max = teste.primeiro, teste.segundo | |
escreva "{min} - {max}: {palindromos(min, max).junte(", ")} | |
|==========" | |
fim | |
# Resultado: | |
# 0 - 20: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11 | |
# ========== | |
# 3000 - 3010: 3003 | |
# ========== | |
# 0 - 1000: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 303, 313, 323, 333, 343, 353, 363, 373, 383, 393, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 505, 515, 525, 535, 545, 555, 565, 575, 585, 595, 606, 616, 626, 636, 646, 656, 666, 676, 686, 696, 707, 717, 727, 737, 747, 757, 767, 777, 787, 797, 808, 818, 828, 838, 848, 858, 868, 878, 888, 898, 909, 919, 929, 939, 949, 959, 969, 979, 989, 999 | |
# ========== | |
# 1000 - 2000: 1001, 1111, 1221, 1331, 1441, 1551, 1661, 1771, 1881, 1991 | |
# ========== | |
# 2000 - 3000: 2002, 2112, 2222, 2332, 2442, 2552, 2662, 2772, 2882, 2992 | |
# ========== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment