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
=begin | |
>> custo_cds(10, 1) | |
=>custo total: 10 | |
=>custo medio: 1 | |
>> custo_cds(10, 1,2,3,1,5,3,7,1,8,2) | |
=>custo_total: 33 | |
=>custo medio: 3,3 | |
>> custo_cds(10, 1.5) | |
custo total: 15 | |
custo medio: 1.5 |
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 |
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
// 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 | |
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
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, 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) | |
OlderNewer