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 random | |
right = 0.0 | |
wrong = 0.0 | |
x = 100000 | |
for i in range(x): | |
items = ['goat','prize', 'goat'] | |
random.shuffle(items) | |
choice = random.randrange(0,3) | |
choice_name = items[choice] |
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
fin_tot = 0 | |
fin_worth = 0 | |
def style_text(one,two): | |
print() | |
print('#'*50) | |
print(one) | |
print(two) | |
print('#'*50) | |
print() |
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 random import randrange | |
a = "+-------+ " | |
b = ["| | ","|* | ","|* *| "] | |
c = ["| | ","| * | ","|* *| "] | |
d = ["| | ","| *| ","|* *| "] | |
while True: | |
count = 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
import re; from sys import argv | |
# start the program like this: | |
# python tabs2spaces.py file_name_to_change.extension | |
file_name = argv[1] | |
read = open(file_name,'r+').read() | |
update = re.sub("[\t]", ' ', read) | |
save = open(file_name, 'w') | |
save.write(update) |
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 random | |
while True: | |
print() | |
print('#'*50) | |
print("ULTIMATE JANKEN!") | |
print("1: Rock 8: Paper ") |
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 random | |
# the board we print out | |
board = ['[0]','[1]','[2]','[3]','[4]','[5]','[6]','[7]','[8]'] | |
# the list of winning combinations | |
win_list = [[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]] | |
X = '\033[92m' + ' X ' + '\033[0m' # makes the x green in *nix systems | |
O = '\033[91m' + ' O ' + '\033[0m' # makes the o red in *nix systems |
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 random | |
file = open("/usr/share/dict/words").read().splitlines() | |
dict = [] | |
for word in file: | |
dict.append(word) | |
guesses = [] | |
incorrect = 10 | |
word = (dict[random.randrange(0,len(dict)-1)]).lower() | |
blank = list('*' * len(word)) |
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
i = 0 | |
count = 0 | |
str = '' | |
roman_list = [1000,900,500,400,100,90,50,40,10,9,5,4,1] | |
roman_dict = {1000:'M',900:'CM',500:'D',400:'CD',100:'C',90:'XC',50:'L',40:'XL',10:'X',9:'IX',5:'V',4:'IV',1:'I'} | |
arabic_dict = {'M':1000, 'CM':900, 'D':500, 'CD':400, 'C':100, 'XC':90, 'L':50, 'XL':40, 'X':10, 'IX':9, 'V':5, 'IV':4, 'I':1} | |
while True: | |
print '1. Arabic to Roman' | |
print '2. Roman to Arabic' |
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
a = [] | |
b = [] | |
i = 0 | |
z = 0 | |
for line in open('/usr/share/dict/words', 'r').readlines(): | |
while i < len(line)-2: | |
a.append(line[i]) | |
i = i + 1 | |
while i > 0: | |
b.append(line[i]) |
NewerOlder