This file contains 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 num2words import num2words | |
numbers = list(range(10,100)) | |
number_to_word_dict = {num : num2words(num) for num in numbers} | |
sorted_numbers = sorted(numbers, key = lambda x : number_to_word_dict[x]) | |
print(sorted_numbers) |
This file contains 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 pandas as pd | |
import github as Github | |
def get_repo_information(org_name, access_token): | |
git = Github(access_token) | |
org = git.get_organization(org_name) | |
repositories = org.get_repos() | |
data = [] |
This file contains 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
Monkey 0: | |
Starting items: 78, 53, 89, 51, 52, 59, 58, 85 | |
Operation: new = old * 3 | |
Test: divisible by 5 | |
If true: throw to monkey 2 | |
If false: throw to monkey 7 | |
Monkey 1: | |
Starting items: 64 | |
Operation: new = old + 7 |
This file contains 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
def fetch_input(file) -> str: | |
''' Fetches the txt file input for the current challenge ''' | |
with open(file, 'r') as file: | |
data = file.read().replace('\n', '') | |
return data | |
def check_start_of_packet(txt,window_length) -> bool: | |
''' Determine if current text is all unique characters ''' |
This file contains 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
16-80,80-87 | |
4-9,10-97 | |
6-94,93-93 | |
31-73,8-73 | |
4-72,5-73 | |
6-63,4-5 | |
3-44,4-45 | |
89-96,95-95 | |
56-95,29-95 | |
5-22,5-22 |
This file contains 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
BdbzzddChsWrRFbzBrszbhWMLNJHLLLLHZtSLglFNZHLJH | |
nnfMwqpQTMffHlNNLllHnZSS | |
cGpcMwfppfqcjcTCBBzWDsDbDrjzWz | |
LhfjhcdjcGdhFfdGfdjdvwCCZMvvLvWwMLCLSwZC | |
rDnsbmptPmlbQMCrQWQQBZQW | |
gltgVPngDPbptPsbPzVgmDldfTdfczThjJJjfMcJdFHjjH | |
dGlgDflTLLLrRLTLVdQLcQMnbvHbbFzNNvMbnHHn | |
sZjWJJCSjWqfCqSjSmJSbFvCzBMBBzHncHNvMBHN | |
twqqwpZwfrlwRwDGDR | |
zCGGFTQMQrsNRNGZdR |
This file contains 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
BdbzzddChsWrRFbzBrszbhWMLNJHLLLLHZtSLglFNZHLJH | |
nnfMwqpQTMffHlNNLllHnZSS | |
cGpcMwfppfqcjcTCBBzWDsDbDrjzWz | |
LhfjhcdjcGdhFfdGfdjdvwCCZMvvLvWwMLCLSwZC | |
rDnsbmptPmlbQMCrQWQQBZQW | |
gltgVPngDPbptPsbPzVgmDldfTdfczThjJJjfMcJdFHjjH | |
dGlgDflTLLLrRLTLVdQLcQMnbvHbbFzNNvMbnHHn | |
sZjWJJCSjWqfCqSjSmJSbFvCzBMBBzHncHNvMBHN | |
twqqwpZwfrlwRwDGDR | |
zCGGFTQMQrsNRNGZdR |
This file contains 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
def fetch_tournament(file) -> list[str]: | |
with open(file) as f: | |
lines = f.readlines() | |
return lines | |
def clean_game(game) -> str: | |
dic = { | |
'A' : 'Rock', |
This file contains 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 math import sqrt | |
def get_triangle_area(a,b,c): | |
''' Given triangle side lengths a,b,c returns the area of the triangle ''' | |
assert a > 0 and b > 0 and c > 0, "Side lengths must be positive" | |
s = (a+b+c)/2 | |
area = sqrt(s*(s-a)*(s-b)*(s-c)) |
This file contains 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
class Solution: | |
def countPoints(self, points: List[List[int]], queries: List[List[int]]) -> List[int]: | |
output = [] | |
def point_distance(circ, point): | |
dist = ((circ[0] - point[0])**2 + (circ[1] - point[1])**2 )**(1/2) | |
return dist | |
for circ in queries: |
NewerOlder