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
| from unittest import TestCase, main | |
| class TestGerarSequencia(TestCase): | |
| def test_sequencia_de_13_deve_ser_13_40_20_10_5_16_8_4_2_1(self): | |
| self.assertEquals([13, 40, 20, 10, 5, 16, 8, 4, 2, 1], gerar_sequencia(13)) | |
| def test_qual_numero_com_maior_sequencia_entre_1_e_1000000(self): | |
| self.assertEquals(maior_numero_com_maior_sequencia_ate(1000000), 837799) | |
| def maior_numero_com_maior_sequencia_ate(numero): |
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
| from unittest import TestCase, main | |
| class TestDecimalBinPalindromicsNumbers(TestCase): | |
| def test_585_and_1001001001_are_palindromic(self): | |
| self.assertTrue(is_palindromic_with_base_2(number=585)) | |
| def test_sum_of_all_palindromic_dec_bin_number_are_1000000(self): | |
| self.assertEquals(sum_all_palindromic_dec_bin_of_numbers_to(1000000), 872187) | |
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
| grep -R 'o_que_voce_quer_modificar' . | cut -d: -f1 | sort -u | xargs sed 's/o_que_voce_quer_modificar/o_que_voce_quer_colocar_no_lugar/' -i |
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
| from unittest import TestCase | |
| import math | |
| class FatorialDeN(TestCase): | |
| def test_soma_do_resultado_do_fatorial_de_10(self): | |
| self.assertEquals(27, soma_do_fatorial_de_n(n=10)) | |
| def test_soma_do_resultado_do_fatorial_de_100(self): | |
| self.assertEquals(648, soma_do_fatorial_de_n(n=100)) |
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
| // create a function that accepts two arguments and return them reverted | |
| function revert(a, b){ | |
| return [b, a]; | |
| } | |
| // create a function that no accepts arguments and return them reverted | |
| function revert(){ | |
| return [ arguments[1], arguments[0] ]; | |
| } |
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
| from unittest import TestCase | |
| class TestFatoresPrimo(TestCase): | |
| def test_fatores_primos_13195(self): | |
| self.assertEquals([5, 7, 13, 29], fatores_primos(13195)) | |
| def test_fatores_primos_600851475143(self): | |
| self.assertEquals([71, 839, 1471, 6857], fatores_primos(600851475143)) | |
| def num_eh_primo(num): |
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
| from unittest import TestCase | |
| from primos import num_eh_primo | |
| class Test10001Primos(TestCase): | |
| def test_achar_sexto_primo(self): | |
| self.assertEquals(13, achar_n_primo(n=6)) | |
| def test_achar_10001_primo(self): | |
| self.assertEquals(104743, achar_n_primo(n=10001)) |
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
| from unittest import TestCase | |
| class TestFatoresPrimo(TestCase): | |
| def test_fatores_primos_13195(self): | |
| self.assertEquals([5, 7, 13, 29], fatores_primos(13195)) | |
| def test_fatores_primos_600851475143(self): | |
| self.assertEquals([71, 839, 1471, 6857], fatores_primos(600851475143)) | |
| def num_eh_primo(num): |
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
| import this |