Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am gaspart on github.
  • I am gaspart (https://keybase.io/gaspart) on keybase.
  • I have a public key whose fingerprint is BE5C B9CD 0AD7 BF89 6648 3CCF 5A57 D523 6250 5DA2

To claim this, I am signing this object:

@gaspart
gaspart / gist:679d90ae81caa9842101
Created February 29, 2016 14:15
Verifying that +gaspart is my blockchain ID. https://onename.com/gaspart
Verifying that +gaspart is my blockchain ID. https://onename.com/gaspart
@gaspart
gaspart / test.py
Last active November 6, 2019 15:27
Scratch to Python - Week 1
name = input("What is your name?")
print("Hello " + name + ". It is nice to meet you")
age = input("How old are you?")
age = int(age)
print("You were born in "+ str(2017 - age))
answer = ""
while not answer == "Who's there":
answer = input("Knock, knock ")
while not answer == "Mikey who":
@gaspart
gaspart / two_dice.py
Last active November 6, 2019 15:27
the result of throwing two dice for a sufficient number of times will approach their probability
from random import randint
from matplotlib import pyplot as plt
run = 0
R2=0
R3=0
R4=0
R5=0
R6=0
R7=0
liquido=input("Dimmi un liquido: ")
polvere=input("Dimmi una polvere: ")
grasso=input("Dimmi un grasso: ")
cibo=input("Dimmi un cibo: ")
frutta1=input("Dimmi una frutta: ")
frutta2=input("Dimmi un'altra frutta: ")
frutta3=input("Dimmi un'ultima frutta: ")
print()
print("Il panettone è ottenuto da un impasto lievitato")
print("a base di "+liquido+", "+polvere+", "+grasso+" e "+cibo+",")
@gaspart
gaspart / I_Ching_generator.py
Created November 6, 2019 15:24
I Ching generator, work in progress
from random import choice, randint
trigram = ["quian", "kun", "zhen", "kan", "gen", "xun", "li", "dui"]
trigram1 = choice(trigram)
trigram2 = choice(trigram)
print("I Ching says: "+trigram1+"-"+trigram2)
#bugged:
while my_num != 6
my_num = input('Guess what number I'm thinking of ')
if my_num > 6:
print('Too high')
elseif my_num < 6:
print('Too low')
else:
print('You guessed it')
for i in range(1,100):
if i % 3 == 0 and i % 5 == 0:
print("FizzBuzz")
elif i % 3 == 0:
print("Fizz")
elif i % 5 == 0:
print("Buzz")
else:
print(i)
@gaspart
gaspart / prime.py
Last active November 20, 2019 11:04
very simple code to check if a number is prime
import sys
i = 2
numero = int(input("Dimmi un numero, e ti dirò se è un NUMERO PRIMO: "))
print()
while i < numero:
if numero % i == 0:
print(str(numero) + " è divisibile per " + str(i))
sys.exit()
i += 1
next
@gaspart
gaspart / sorting.py
Created November 20, 2019 13:37
transform a string into a list, then sort descending and choose random
from random import choice
a_list = '54 - Alice,35 - Bob,27 - Carol,27 - Chuck,05 - Craig,30 - Dan,27 - Erin,77 - Eve,14 - Fay,20 - Frank,48 - Grace,61 - Heidi,03 - Judy,28 - Mallory,05 - Olivia,44 - Oscar,34 - Peggy,30 - Sybil,82 - Trent,75 - Trudy,92 - Victor,37 - Walter'
myList = a_list.split(',')
myList.sort(reverse=True)
print(myList)
print()
print(choice(myList))