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
# Find the length of the longest streak of positive values in a list of numbers | |
gains1 = [-2 ,-2, 1, 1] | |
def find_streak(values): | |
streakimg = False | |
streak = 0 | |
pos = 0 | |
start = 0 | |
finish = 0 | |
current_start = 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
# We count two things. (1) How many letters are correct but in the wrong position. This is r and the first number in the output. (2) How many letters are correct but in the wrong position. This is s and the second number output. | |
# Input variables. | |
length = 4 | |
code = 'BACC' | |
guess ='CABB' | |
# The set of letters in the code. This is used to elimimate repetitions. | |
let = set(code) |
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
# We count two things. (1) How many letters are correct but in the wrong position. This is r and the first number in the output. (2) How many letters are correct but in the weon position | |
# Input variables. | |
length = 8 | |
code = 'ABCDEEFF' | |
guess ='AEFFECDZ' | |
# The set of letters in the code. This is used to elimimate repetitions. | |
let = set(code) |
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
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' | |
row_list = ['AAA', 'BBB', 'AAA'] | |
bd = row_list[0] + row_list[1] + row_list[2] | |
""" |
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
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' | |
row_list = ['AAA', 'BBB', 'AAA'] | |
bd = row_list[0] + row_list[1] + row_list[2] | |
""" |
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
""" | |
0 1,500.00 0.00 | |
1 1,308.52 44.18 | |
2 1,210.59 64.08 | |
3 1,111.17 82.49 | |
4 1,010.24 99.39 | |
5 907.77 114.75 | |
6 803.75 128.56 | |
7 698.14 140.78 | |
8 590.93 151.40 |
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
# Project | |
def drinks(e,f,c): | |
total = 0 | |
while((e + f) >= c): # Do we have enough empties? | |
d = (e + f)//c # How many can Tom buy? | |
f = (e + f) % c # How many leftover? | |
total += d # How many did Ton drink this time? | |
e = d # More empty bottle | |
return total |
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
e=1 | |
f=9 | |
c=3 | |
def drinks(e,f,c): | |
total = 0 | |
while((e + f) >= c): # Do we have enough empties? | |
d = (e + f)//c # How many can Tom buy? | |
left = (e + f) % c # How many leftover? | |
total += d # How many did Ton drink this time? | |
e = d # More empty bottle |
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
(((())))()((((((((())()(()))(()((((()(()(((()((()((()(()()()()()))(((()(()((((((((((())(()()((())()(((())))()(()(()((()(()))(()()()()((()((()(((()()(((((((()()())()((((()()(((((()(())()(())((())()()))()(((((((())(()())(()(((())(()))((())))(()((()())))()())((((())))(()(((((()(())(((()()((()((()((((((((((())(()())))))()))())()()((((()()()()()()((((((())())(((()())()((()()(((()()()))(((((()))(((()(()()()(()(()(((())()))(()(((()((())()(()())())))((()()()(()()(((()))(((()((((()(((((()()(()())((()())())(()((((((()(()()))((((()))))())((())()()((()(()))))((((((((()))(()()(((())())(())()((()()()()((()((()((()()(((())))(()((())()((((((((()((()(()()(((())())())))(())())))()((((()))))))())))()()))()())((()())()((()()()))(()()(((()(())((((())())((((((((()()()()())))()()()((((()()))))))()((((()(((()))(()()())))((()()(((()))()()())())(((())((()()(())()()()(((())))))()())((()))()))((())()()())()())()()(()))())))())()))(())((()(())))(()(())(()))))(()(())())(()(())(()(()))))((()())()))()((((()()))))())))()()())((())()((()()()) |
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 spell check program by Peter Norvig. | |
Found here: | |
http://norvig.com/spell-correct.html | |
""" | |
import re | |
from collections import Counter | |