Skip to content

Instantly share code, notes, and snippets.

Avatar
😭
Sad and Brazilian

Ana Luiza Portello Bastos anabastos

😭
Sad and Brazilian
View GitHub Profile
View triangulinho.py
n= input("Numero de linhas: ")
if n>1:
for i in range(n):
n-=1
print " "*n+"."+" ."*i
else:
print(".")
View gist:ae9f7c34cb1e1c5f9f2f
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:
@anabastos
anabastos / fermat.c
Last active Oct 2, 2016
Desafio Fermat
View fermat.c
#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;
}
@anabastos
anabastos / fermatgoto.c
Created Oct 3, 2016
Fermat usando goto q fico horrivel
View fermatgoto.c
#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);
@anabastos
anabastos / gist:b98af2fd2cc881d14349faff7f4ec100
Last active Jan 22, 2017
Como instalar o ambiente do projeto no UBUNTU
View gist:b98af2fd2cc881d14349faff7f4ec100
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
View Atv TDD
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
View desafio.js
//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)
View show-me.js
/**
* 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)
@anabastos
anabastos / criaArrayPrimos.js
Last active Jan 7, 2020
Dado um número aleatório, retornar todos os números PRIMOS entre 0 e o número escolhido
View criaArrayPrimos.js
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)
@anabastos
anabastos / desafio1.js
Created Mar 17, 2017
Desafio map -js4girls
View desafio1.js
//tendo uma matrix 4x4 multiplicar apenas os valores pares
var matrix = [
[1, 11, 32],
[13, 14, 15],
[7, 6, 2]
]
//resultado esperado:
// [