This file contains 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
n= input("Numero de linhas: ") | |
if n>1: | |
for i in range(n): | |
n-=1 | |
print " "*n+"."+" ."*i | |
else: | |
print(".") |
This file contains 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
piramid = map(lambda n: "/n".join([" "*(n-i-1)+"."+" ."*i for i in range(n) if n>1])) | |
def piradimidinha_rec(n): | |
if n < 1 return ["."] | |
map(lambda piramid2: piramid1(n-1)+" .") | |
return " "*n-1+"*"+ | |
n= input("Numero de linhas: ") | |
if n>1: |
This file contains 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
#include <stdio.h> | |
int ehPrimo(long number) { | |
int i; | |
for (i=2; i<number; i++) { | |
if (number % i == 0 && i != number) return 0; | |
} | |
return 1; | |
} |
This file contains 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
#include <stdio.h> | |
int main () { | |
long n, pPrimo, qPrimo, p, q, e, x, y; | |
int i, j; | |
printf ("-----------"); | |
printf ("\nF e R m A t"); | |
printf ("\n-----------"); | |
printf ("\nDigite um numero impar: "); scanf ("%ld", &n); |
This file contains 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
Copie e cole esses comandos no terminal | |
Instalar python e pip(instalador do python): | |
sudo apt-get install python | |
sudo apt-get install python-pip | |
Instalar o banco de dados mongo: | |
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 | |
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list | |
sudo apt-get install -y mongodb-org |
This file contains 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
Entrar no repositorio do github e clicar no botao de fork. Isso vai criar um repositorio igual pra sua conta | |
Entrar nesse seu repositorio e clona-lo | |
git clone (link) | |
cd furlong | |
Instalações: | |
sudo apt-get install ruby | |
gem install rspec -v 3.4.0 | |
Digite no terminal para rodar os testes |
This file contains 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
//dado o array de dictionary abaixo some o total dos valores | |
let dictionary = [{ '5': 50, '6': 60 }, { 'A': 10 }, { 'YEEZY': 30 }] | |
dictionary.reduce((acc, val) => acc.concat(Object.values(val)), []).reduce((acc, val) => acc + val, 0) |
This file contains 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
/** | |
* Show Me the Evens - Show me the Odds | |
* Diana is learning to count and she just learned the difference between odds and even numbers. | |
* She wants to have some fun, so she picks a random number. | |
* If that number is even, she decides to count all the even numbers up to it starting from 0 up to (but not including) the input. | |
* If not, she decides to count all the odd numbers up to that number starting from 1 (but not including) the input. | |
**/ | |
const counting = (x) => { | |
return arrayFrom(x) |
This file contains 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
const criaArrayPrimos = x => | |
criaArray(x) | |
.slice(2) | |
.filter(checaFatores) | |
const criaArray = tamanho => Array.from({ length: tamanho }, (el, index) => index) | |
const checaFatores = n => | |
criaArray(maiorDivisor(n)) | |
.slice(2) |
This file contains 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
//tendo uma matrix 4x4 multiplicar apenas os valores pares | |
var matrix = [ | |
[1, 11, 32], | |
[13, 14, 15], | |
[7, 6, 2] | |
] | |
//resultado esperado: | |
// [ |
OlderNewer