Skip to content

Instantly share code, notes, and snippets.

@An-Nguyen1
An-Nguyen1 / Coin flip simulator.py
Created July 27, 2019 18:23
Simulate as much coin flip as your computer cane handle
import random
flips = int(input('how many times do you want to flip the coin? '))
outcomes = ['head','tail']
wieghts = [.5,.5]
head=0
tail=0
for flip in range(flips):
h_t = random.choice(outcomes)
if h_t == 'head':
head += 1
@An-Nguyen1
An-Nguyen1 / Card_game_base.py
Created July 27, 2019 04:54
This is a starter for most text base card game
import random
deck = []
hand = []
card = None
score = 0
with open('deck.txt', 'r') as d:
for line in d:
deck.append(line.strip('\n'))
random.shuffle(deck)