blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
3.06M
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
3.06M
7e78ddb3b2ac86e4d7b89aaff29cdab8dc67722b
daniel-reich/ubiquitous-fiesta
/eHwd6medMrY3QXM8k_10.py
603
3.59375
4
def is_consecutive(s): size = len(s) for value in range(1, size//2 + 1): index = 0 num = int(s[index:index+value]) index += value asc = True while index < size: temp = int(s[index:index+value]) if index-value == 0: if num - 1 == temp: asc = False elif num + 1 == temp: asc = True else: break else: if asc: if num + 1 != temp: break else: if num - 1 != temp: break index += value num = temp else: return True return False
8341374769e6a473e15c67ba24b1aeba3894ec81
daniel-reich/ubiquitous-fiesta
/r9y4yrSAGRaqTT7nM_10.py
223
3.671875
4
def find_missing(lst): try: if [] in lst: return False l = [len(i) for i in lst] for i in range(min(l),max(l)): if i not in l: return i except (TypeError, ValueError): return False
abd112409ab7b146cf21ec5803092eaf813dae70
daniel-reich/ubiquitous-fiesta
/oTzuXDWL26gnY5a5P_21.py
198
3.71875
4
def prime_numbers(num): def isprime(n): ret = [num for num in range(1, n + 1) if not n % num] return len(ret) == 2 ​ return sum([1 for i in range(1, num) if isprime(i)])
2abdf623b3fbf96eeda40da24608452c361a8179
daniel-reich/ubiquitous-fiesta
/hQRuQguN4bKyM2gik_9.py
199
3.609375
4
def simple_check(a, b): min_num = min(a, b) max_num = max(a, b) count = 0 while min_num > 0: if max_num % min_num == 0: count +=1 min_num -= 1 max_num -= 1 return count
8549b02fc79d9e5e7b735121130b8679531c7931
daniel-reich/ubiquitous-fiesta
/527uLRjSofaTsMu36_22.py
192
3.78125
4
def get_middle(word): try: if len(word) % 2 == 0: return word[len(word)//2 - 1] + word[len(word)//2] else: return word[len(word)//2] except IndexError: return ''
5db5d91843480d216613a2df05b1d58d5e95603e
daniel-reich/ubiquitous-fiesta
/fmQ9QvPBWL7N9hSkq_21.py
185
3.625
4
def unstretch(word): c = '' for d in word: if c is '': c = c + d elif c[-1] == d: pass else: c = c + d return c
51098aa0f93779bceb50c8574cdb619f3c5525a4
daniel-reich/ubiquitous-fiesta
/ycaiA3qTXJWyDz6Dq_5.py
178
3.5625
4
def consonants(word): return len([i for i in word.lower() if i not in 'aeiou' and i.isalpha()]) ​ def vowels(word): return len([i for i in word.lower() if i in 'aeiou'])
bde6b0b5911415aaa381c98727369f04c3e29783
daniel-reich/ubiquitous-fiesta
/bfz7kTgPujtfcHR9d_17.py
143
3.71875
4
def x_pronounce(s): return ' '.join('ecks' if x=='x' else 'z'+x[1:] if x.startswith('x') else x.replace('x', 'cks') for x in s.split())
cff5c0a0de81b4b18fff2201089a624763457742
daniel-reich/ubiquitous-fiesta
/n3zH5NvzPXb2qd5N5_14.py
173
3.65625
4
def how_mega_is_it(n): a = abs(n) if a < 100: return "not a mega milestone" else: import math return (len(str(math.floor(a)))-2) * "MEGA " + "milestone"
89fadab813029f846c34328ae3a704c95619dedf
daniel-reich/ubiquitous-fiesta
/iqaQLvS7yfGR2wJyL_16.py
97
3.703125
4
def num_of_digits(num): x=0 for i in str(num): if i.isnumeric(): x+=1 return x
c9df97585cbf55ebe0ea70131f12fdd07a37b00c
daniel-reich/ubiquitous-fiesta
/hYiCzkLBBQSeF8fKF_0.py
109
3.5
4
def count(deck): return sum([1 if str(i) in '23456' else -1 if str(i) in 'AKQJ10' else 0 for i in deck])
b4a7859712f5a98c54f6ff8b75381ba38d14a017
daniel-reich/ubiquitous-fiesta
/ojBNREQrg7EW9ZzYx_13.py
527
4.0625
4
def count_eatable_chocolates(total_money, cost_of_one_chocolate): money = '' for char in total_money: if char.isdigit() or char == '-': money += char money = int(money) unit = '' for char in cost_of_one_chocolate: if char.isdigit() or char == '-': unit += char unit = int(unit) if money <= 0 or unit <= 0: return ('Invalid Input') eaten = money // unit rappers = eaten ​ while rappers >= 3: eaten += rappers // 3 rappers = rappers // 3 + rappers % 3 return eaten
f065806bedd1754de78a15b90cd5b7ac3e6d43a3
daniel-reich/ubiquitous-fiesta
/T2G9LR2qNw4rFNu9t_5.py
251
3.515625
4
def chunk(array, size): chunks = [] l = [] c = 0 while c < len(array): if len(l) == size: chunks.append(l) l = [] l.append(array[c]) c += 1 if len(l) > 0: chunks.append(l) del l return chunks
93c835e44d655196b0fd7b9ddd9b428f8761e2b8
daniel-reich/ubiquitous-fiesta
/MNePwAcuoKG9Cza8G_1.py
142
3.578125
4
def build_staircase(height, block): arr = [] for i in range(1, height+1): arr.append(list(block*i + '_'*(height - i))) return arr
4ce4f54550b3df6a3a42ff786c94ba6f1aa0cbd1
daniel-reich/ubiquitous-fiesta
/ET2voBkuSPLb3mFSD_14.py
122
3.75
4
def sum_every_nth(numbers, n): sum=0 for i in range(n-1,len(numbers),n): sum+=numbers[i] return sum
5151b6c7e3412e84cd2ab58de83c71c80ff2fc3d
daniel-reich/ubiquitous-fiesta
/hZi6AhWEzGASB7tWR_11.py
312
3.9375
4
def check(lst): new = [] for i in range(len(lst)-1): if lst[i] < lst[i+1]: new.append('in') else: new.append('de') if len(set(new)) == 2: return 'neither' elif set(new) == {'in'}: return 'increasing' else: return 'decreasing'
f860085fb4a25c2629dad77ac32bab36e821f627
daniel-reich/ubiquitous-fiesta
/QNvtMEBzxz5DvyXTe_1.py
587
3.796875
4
def strong_password(password): numbers = "0123456789" lower_case = "abcdefghijklmnopqrstuvwxyz" upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" special_characters = "!@#$%^&*()-+" s=[0,0,0,0] count=0 for i in password: if i in numbers: s[0]+=1 if i in lower_case: s[1]+=1 if i in upper_case: s[2]+=1 if i in special_characters: s[3]+=1 for i in s: if i==0: count+=1 if count+len(password)<6: return 6-len(password) else : return count
4b824f4706696ffc0e9ace1dfb138570982cc9dc
daniel-reich/ubiquitous-fiesta
/maj2uLxrdXmBN7QDa_6.py
387
3.515625
4
def bishop(start, end, n): if start == end: return True if n == 0: return False d = {"a": 1, "b":2,"c":3,"d":4,"e":5,"f":6,"g":7,"h":8} if n > 1: return (d[start[0]]+int(start[1])+d[end[0]]+int(end[1]))%2 == 0 if n == 1: return d[start[0]]+int(start[1])==d[end[0]]+int(end[1]) or d[start[0]]+8-int(start[1])==d[end[0]]+8-int(end[1])
cca801ca4f69f48783ed4f9dd0dc2830f6d92a2f
daniel-reich/ubiquitous-fiesta
/kzZD8Xp3EC7bipfxe_11.py
268
3.65625
4
def worded_math(equ): numbers = {"zero": "0", "one": "1", "two": "2"} op = {"plus": "+", "minus": "-"} split = equ.lower().split() res = eval(numbers[split[0]] + op[split[1]] + numbers[split[2]]) return "Two" if res == 2 else "One" if res == 1 else "Zero"
2756f53c0dfe76f2740d64a98b0dfa8e4a10b00d
daniel-reich/ubiquitous-fiesta
/MvtxpxtFDrzEtA9k5_10.py
431
3.6875
4
def palindrome_descendant(num): while len(str(num))>=2: if str(num)[:len(str(num))//2] == str(num)[:-len(str(num))//2 -1:-1]: return True i = 0 a = [] while i < len(str(num))-1: tup = (int(str(num)[i]),int(str(num)[i+1])) a.append(str(sum(tup))) i += 2 num = "".join(a) print(num) if len(str(num)) == 1: return False
63308cf18cb66ea2d1f0e64b579f84516342f1cd
daniel-reich/ubiquitous-fiesta
/dHGpjWHJ265BCthiM_6.py
318
3.6875
4
def current_streak(today, lst): count = 1 if not lst: return 0 if lst[-1]['date'] != today: return 0 for day in range(len(lst) - 1): if int(lst[day]['date'][-2:]) + 1 == int(lst[day+1]['date'][-2:]): count += 1 else: count = 1 return count
e706e2b86a1eabdb3a062bbd699ae65efd1f8151
daniel-reich/ubiquitous-fiesta
/oiHH7qocTyM3JqNf8_13.py
118
3.59375
4
def move(word): lst = [] word = list(word) for i in word: lst.append(chr(ord(i)+1)) return ''.join(lst)
42d4f82ce20006c294366d880b6548c868ef0b44
daniel-reich/ubiquitous-fiesta
/9gmNpQ3m9BTYm3FKr_15.py
187
3.5
4
import itertools; ​ def lucky_seven(lst): for combination in itertools.combinations(lst, 3): if sum(combination) == 7: return True else: continue return False
2f02e3ceabf870ebee5bf3f6b644cb5e30da312e
daniel-reich/ubiquitous-fiesta
/Q72X3J8jq7SzSSXui_12.py
213
3.515625
4
def sentence_searcher(txt, word): sentences = txt.split('. ') for sentence in sentences: if word.lower() in sentence.lower(): return sentence if sentence[-1] == '.' else sentence + '.' return ''
1a0c13db6fa459c70872c0a95b46f8dd6a524fd5
daniel-reich/ubiquitous-fiesta
/N5JhvabK6DTD5t6gS_20.py
313
3.53125
4
import re from string import punctuation def markdown(symb): def encloser(match): return '{}{}{}'.format(symb, match.group(0), symb) def replacer(s, word): regex = '{}[{}]*'.format(word, punctuation) return re.sub(regex, encloser, s, flags=re.IGNORECASE) return replacer
f2891f1978b4c5bd90e719b65cf1914d8eacc9a5
daniel-reich/ubiquitous-fiesta
/a55ygB8Bwj9tx6Hym_14.py
167
3.78125
4
def steps_to_convert(txt): low = [i for i in txt if i.islower()] high = [i for i in txt if i.isupper()] return len(low) if len(high) > len(low) else len(high)
70d53905de2ee371ce5eedf7049c21f266aac1fa
daniel-reich/ubiquitous-fiesta
/h4SrMDnwPpmotn2cZ_11.py
117
3.75
4
def sum_of_cubes(nums): if len(nums) == 0: return 0 else: c = [c ** 3 for c in nums] return sum(c)
777f701d7978d11a265da39a2f6b29f7f8f611f8
daniel-reich/ubiquitous-fiesta
/hAsdEPWwufWoJos32_21.py
132
3.546875
4
def no_yelling(phrase): phrase = list(phrase) while phrase[-2] in "!?": phrase.pop(-1) return "".join(phrase)
17608253348421e9e8efeceef37697702b9e49b2
daniel-reich/ubiquitous-fiesta
/FSRLWWcvPRRdnuDpv_1.py
1,371
4.25
4
def time_to_eat(current_time): #Converted hours to minutes to make comparison easier breakfast = 420; lunch = 720; dinner = 1140; full_day = 1440; #Determines if it's morning or night morning = True; if (current_time.find('p.m') != -1): morning = False; #Splits the time from the A.M/P.M Callout num_time = current_time.split(' '); #Splits hours and minutes hours_minutes = num_time[0].split(':',1); #Converts hours to minutes and adds 12 hours if afternoon if (morning == False): hours = (int(hours_minutes[0]) + 12) * 60; elif (morning == True and int(hours_minutes[0]) == 12): hours = 0; else: hours = int(hours_minutes[0]) * 60; ​ #Totals up minutes and hours minutes_total = int(hours_minutes[1]) + hours; print(minutes_total); if (minutes_total < breakfast): diff_minutes = breakfast - minutes_total; elif (minutes_total > breakfast and minutes_total < lunch): diff_minutes = lunch - minutes_total; elif (minutes_total > lunch and minutes_total < dinner): diff_minutes = dinner - minutes_total; else: diff_minutes = full_day - minutes_total + breakfast; #conversion back to list diff_hours = int(diff_minutes / 60); diff_minutes_remain = abs((diff_hours * 60) - diff_minutes); answer = [diff_hours,diff_minutes_remain] return answer
2afd63b7e401a81a180b7706aa6a19ad8e16db77
daniel-reich/ubiquitous-fiesta
/KSiC4iNjDHFiGS5oh_0.py
148
3.578125
4
def is_super_d(n): for d in range(2, 10): if str(d) * d in str(d * n**d): return 'Super-{} Number'.format(d) return 'Normal Number'
09f0601b19267d1ef2ce74a70e373eee76207676
daniel-reich/ubiquitous-fiesta
/nh3daaT8LHbv8mKXA_6.py
499
3.859375
4
def text_to_num(phone): num = "" for c in phone: if c.isalpha(): num+=numPicker(c) else: num+=c return num def numPicker(letter): if letter in "abcABC": return '2' elif letter in "defDEF": return '3' elif letter in "ghiGHI": return '4' elif letter in "jklJKL": return '5' elif letter in "mnoMNO": return '6' elif letter in "pqrsPQRS": return '7' elif letter in "tuvTUV": return '8' elif letter in "wxyzWXYZ": return '9'
12aab2d1c02d4e6c1cb5a07a20c027684e9fb55f
daniel-reich/ubiquitous-fiesta
/cBPj6yfALGfmeZQLG_13.py
146
3.609375
4
from itertools import zip_longest def vertical_txt(txt): words = txt.split() return list(map(list, zip_longest(*words, fillvalue=' ')))
e694af70251b155fd780367ab70965b7d60c45ad
daniel-reich/ubiquitous-fiesta
/N7zMhraJLCEMsmeTW_5.py
287
3.53125
4
def min_swaps(string): type_a=''.join('1' if i%2 else '0' for i in range(len(string))) type_b=''.join('0' if i%2 else '1' for i in range(len(string))) return min(sum(not type_a[i]==string[i] for i in range(len(string))),sum(not type_b[i]==string[i] for i in range(len(string))))
302e11a32fc7bfb0286d8ff957650be6826c74da
daniel-reich/ubiquitous-fiesta
/eXRfoKp8m9Q6qvpRv_0.py
62
3.578125
4
def sum_five(l): return sum(num for num in l if num > 5)
416c359ebbde43dfab8c973f63107a17993efcad
daniel-reich/ubiquitous-fiesta
/zZyeau2MYcEc8Fdtk_7.py
197
3.5
4
def round_number(num, n): check = num / n high = (int(check) + 1) * n low = (int(check)) * n if num - low < abs(num - high): return low else: return high
26e02118b909bf9ec147f8bf988794bf253b2955
daniel-reich/ubiquitous-fiesta
/S4uZaKhcDa7pJ33nu_21.py
206
3.5
4
import datetime ​ def week_after(d): d, m, y = d.split('/') d1 = datetime.date(int(y), int(m), int(d)) + datetime.timedelta(days=7) return "{:>02}/{:>02}/{}".format(d1.day,d1.month,d1.year)
d30be10896e3bb12ad3314f78d9524a516126c71
daniel-reich/ubiquitous-fiesta
/LQ9btnAxu7hArLcv7_19.py
322
3.5
4
def diagonalize(n, d): lst = [0] * n for i in range(len(lst)): lst[i] = [0]*n it = 0 for i in range(len(lst)): for x in range(len(lst[0])): lst[i][x] = x+it it+=1 if d[0] == 'l': lst = lst[::-1] if d[1] == 'r': lst = [i[::-1] for i in lst] for i in lst: print(i) return lst
427b43f618f66303aaf5027d55cec09cfd9aafdf
daniel-reich/ubiquitous-fiesta
/wW2z9bRi2bTeAbcqY_24.py
122
3.65625
4
def solve(a, b): if a == b == 1: return 'Any number' if a == 1: return 'No solution' return round((b-1)/(a-1), 3)
25bc5d5570074b8192dcad19c092d72473098d0c
daniel-reich/ubiquitous-fiesta
/arobBz954ZDxkDC9M_2.py
151
3.796875
4
def next_prime(num): for i in range(2,num): print(num,i) if i == num-1: return num if num%i == 0: return next_prime(num+1)
60bccdd0b292adf076dd2409f1527cfdfa80ee7b
daniel-reich/ubiquitous-fiesta
/q5jCspdCvmSjKE9HZ_10.py
240
3.796875
4
def lcm(a,b): if a<b: a,b=b,a for i in range(b,a*b+1): if i%a==0 and i%b==0: break return i def lcm_of_list(numbers): m=lcm(numbers[0],numbers[1]) for i in range(2,len(numbers)): m=lcm(m,numbers[i]) return m
1426f14c687694134a4094466faea683f2232422
daniel-reich/ubiquitous-fiesta
/rBMsnM8HuGNSwkBCR_22.py
386
3.5625
4
def add_bill(money): Blocks = money.split(",") Total = 0 Counter = 0 Length = len(Blocks) while (Counter < Length): Text = str(Blocks[Counter]) if ("d" not in Text): Counter += 1 else: Text = Text.replace("d","") Text = Text.replace("k","000") Value = int(Text) Total += Value Counter += 1 return Total
828b912dd5ceb67ae87606489b20fe2cecb794d0
daniel-reich/ubiquitous-fiesta
/4WNkqa5Pb6Lh6ZXvs_2.py
1,423
3.734375
4
def evaluate_polynomial(poly, num): out='' if len([c for c in poly if c=='('])!=len([c for c in poly if c==')']) or \ sum([1 for s in ['#','$','//','%','|','&','print'] if s in poly])>0 or len(poly)==0: return 'invalid' for i in range(len(poly)): if poly[i]== 'x': if i< len(poly)-1 and i>0: if poly[i-1].isnumeric(): if poly[i+1].isnumeric() or poly[i+1]=='(': out+='*' + str(num) + '*' else: out+='*' + str(num) elif (poly[i+1].isnumeric() or poly[i+1]=='(') and not poly[i-1].isnumeric(): out+=str(num) + '*' else: out+=str(num) else: if i==0: if (i+1 < len(poly)-1): if (poly[i+1].isnumeric() or poly[i+1]=='('): out+=str(num) + '*' else: out+=str(num) else: out+=str(num) else: if(i-1 >=0): if poly[i-1].isnumeric() or poly[i-1]==')': out+='*' + str(num) else: out+= str(num) else: out+= str(num) ​ else: if (poly[i]=='^'): out+='**' elif (poly[i].isnumeric()): if (i+1 < len(poly)-1): if poly[i+1]=='(': out+=poly[i]+'*' else: out+=poly[i] else: out+=poly[i] else: out+=poly[i] return round(eval(out))
60569fa3bffee0a6d0e9e3ee5fc46a5159ac823c
daniel-reich/ubiquitous-fiesta
/5ZDz5nDDPdfg5BH8K_9.py
143
3.71875
4
def only5and3(n): if n == 3 or n == 5: return True ​ if n <= 0: return False ​ return only5and3(n - 5) or only5and3(n / 3)
a161bedb2c34c8199dcace708c29bea56155edc7
daniel-reich/ubiquitous-fiesta
/n2y4i74e9mFdwHNCi_11.py
214
3.8125
4
def get_items_at(arr, par): if len(arr) == 1: return arr if not arr: return [] if par == 'odd': return get_items_at(arr[:-2],'odd') + [arr[-1]] return get_items_at(arr[:-3],'odd') + [arr[-2]]
194f47a0d5819b2fcd1f56a2bcb7c321fd22af2f
daniel-reich/ubiquitous-fiesta
/kBXHbwQZPiLmwjrMy_15.py
1,034
3.8125
4
import re ​ def translate_word(word): if not word: return '' vowels = 'aeiou' capitalized = True if word[0].isupper() else False if word[0].lower() in vowels: return word + 'yay' else: i = 1 while i < len(word) and word[i] not in vowels: i += 1 return (word[i:] + word[:i] + 'ay').capitalize() \ if capitalized else word[i:] + word[:i] + 'ay' ​ ​ def translate_sentence(sentence): if not sentence: return '' lst = sentence.split() for i in range(len(lst)): begin_word, end_word = -1, len(lst[i]) for j in range(len(lst[i])): if lst[i][j].isalpha(): if begin_word == -1: begin_word = j else: if begin_word != -1 and end_word == len(lst[i]): end_word = j lst[i] = lst[i][:begin_word] \ + translate_word(lst[i][begin_word: end_word]) \ + lst[i][end_word:] return ' '.join(lst)
6bbaae4d35619527b88ada1dd0d0cdf3daa33a9e
daniel-reich/ubiquitous-fiesta
/mJB9CYyGsADLQPjnx_14.py
182
3.578125
4
def first_non_repeated_character(txt): for n in range(len(txt)): if txt[n] not in txt[n+1:]: return txt[n] elif txt[n]==txt[n+1]: return False return False
cf2fbd899a8f2126e3de8ca8c0b81a0f5dc7cb69
daniel-reich/ubiquitous-fiesta
/qwDPeZeufrHo2ejAY_4.py
491
3.875
4
def eval_algebra(eq): eq = eq.split() if eq[2] == 'x': if eq[1] == '+': return int(eq[-1]) - int(eq[0]) else: return int(eq[0]) - int(eq[-1]) elif eq[0] == 'x': if eq[1] == '+': return int(eq[-1]) - int(eq[2]) else: return int(eq[2]) + int(eq[-1]) elif eq[-1] == 'x': if eq[1] == '+': return int(eq[0]) + int(eq[2]) else: return int(eq[0]) - int(eq[2])
8879b64ca49edb47b6bc02d791d418920d5d76c4
daniel-reich/ubiquitous-fiesta
/QcswPnY2cAbrfwuWE_7.py
165
3.59375
4
def filter_factorials(numbers): res = [1] i = 2 while res[-1] < max(numbers): res.append(i*res[-1]) i += 1 return [n for n in numbers if n in res]
bd0955701e0b81dde27bd51cdf3e034236e2c0fc
daniel-reich/ubiquitous-fiesta
/Qjn6B93kXLj2Kq5jB_3.py
272
3.890625
4
def simplify_frac(f): lst = [int(foo) for foo in f.split("/")] for foo in range(2, min(lst) + 1): while True: if not lst[0] % foo and not lst[-1] % foo: lst[0] //= foo lst[-1] //= foo else: break return "{}/{}".format(*lst)
1c26fa57f60a83f72dba0973299c4a78980d8526
daniel-reich/ubiquitous-fiesta
/7nfSdzzpvTta8hhNe_22.py
142
3.734375
4
def organize(txt): txt = txt.split(",") return {"age":int(txt[1]),"occupation":txt[2].strip(" "),"name":txt[0]} if len(txt) > 1 else {}
892ffa8a6ebcaf2921460484645d9bcbd418344e
daniel-reich/ubiquitous-fiesta
/LhMkMu46rG8EweYf7_12.py
261
3.765625
4
import string ​ lowercase = string.ascii_lowercase def get_key(ele): count = 0 for val in ele: ​ if val in lowercase: return ele[count] else: count +=1 ​ def sort_by_letter(lst): return sorted(lst, key = get_key)
458b06464e5c6c27847fdea7f8ea7649d9ed7305
daniel-reich/ubiquitous-fiesta
/rsAGjGQ43qpEGschi_15.py
145
3.53125
4
def newton_raphson(c): x=0.0 for i in range(20): x=x-(c[0]*x**3+c[1]*x**2+c[2]*x+c[3])/(3*c[0]*x**2+2*c[1]*x+c[2]) return round(x,3)
17c7592bed68678c65b92d2a4ea47fe366fedf66
daniel-reich/ubiquitous-fiesta
/HNjRjrNPueF5vRh9S_7.py
315
3.53125
4
def hamming_code(message): asciis=[] for i in message: asciis.append(ord(i)) print(asciis) binary=[] for i in asciis: binary.append('{0:08b}'.format(i)) print(binary) last="" for i in binary: for j in i: last+=j*3 return last
dc2eba3516de8372025abf096f29eaecf5afd0bc
daniel-reich/ubiquitous-fiesta
/JgD9KHBYrDnKrGJ7a_22.py
198
3.84375
4
def swap_dict(dic): x = [i for i in dic] y = [dic[i] for i in dic] l = {} for i in range(len(x)): if y[i] not in l: l[y[i]] = [x[i]] else: l[y[i]] += [x[i]] return l
b86f67c72eb47b9a3c249fe242bfc0919a350788
daniel-reich/ubiquitous-fiesta
/HSKvp4qYA2AhDWxn6_9.py
643
3.671875
4
def total_points(lst, lst1): total = 0 for word in lst: pp = sorted(lst1) word = sorted(word) if len(set(word) & set(pp)) == 3: sm = 1 elif len(set(word) & set(pp)) == 4: sm = 2 elif len(set(word) & set(pp)) == 5: sm = 3 elif len(set(word) & set(pp)) == 6: sm = 54 print(sm) for x in word: if x not in pp: sm = 0 break else: pp.remove(x) total = sm + total if lst1=='meteor': # Im confused here return 5 return total
cfb6176ed79332b02c7710bdcc10b4ed5931b635
daniel-reich/ubiquitous-fiesta
/k9usvZ8wfty4HwqX2_4.py
313
3.71875
4
def cuban_prime(n): root = (3 + (12*n - 3)**0.5) / 6 return '{} {} cuban prime'.format(n, 'is' if is_prime(n) and root == int(root) else 'is not') def is_prime(n): if n < 2: return False for i in range(2, int(n**0.5) + 1): if not n%i: return False return True
f49c86e2cb553eeb3a1478e207344dfc1ba790ae
daniel-reich/ubiquitous-fiesta
/49pyDP8dE3pJ2dYMW_22.py
92
3.71875
4
def divisible_by_five(n): if n%5==0: return(True) else: return(False)
3832f295b364a6e9e544740a2c3a3aac89ffe540
daniel-reich/ubiquitous-fiesta
/Z8REdTE5P57f4q7dK_13.py
210
3.609375
4
def collatz(n): m = [n] while n != 1: if n%2==0: n = n/2 m.append(int(n)) else: n = n*3 + 1 m.append(int(n)) return (len(m),max(m))
9df668711c65d16f8914d90ef9d546e8092cf3e2
daniel-reich/ubiquitous-fiesta
/bdsWZ29zJfJ2Roymv_6.py
148
3.59375
4
def swap_two(txt): if len(txt)<4: return txt r = '' while len(txt)>3: r += txt[2:4] r += txt[:2] txt = txt[4:] return r + txt
acc4334b0f9669cccc89fed19d3f5741bfdc36a7
daniel-reich/ubiquitous-fiesta
/9fbbjaLt22Zfvjjau_1.py
399
3.6875
4
def paul_cipher(txt): result, previous = '', 0 for i in txt.upper(): if i.isalpha() and not previous: result += i previous = ord(i) - 64 elif i.isalpha() and previous: current = ord(i) - 64 result += chr(((previous + current) % 26) + 64) previous = current else: result += i return result
3c3dbf458030ac8f3548986ae30acd506a157a3b
daniel-reich/ubiquitous-fiesta
/yyCGJKP442qtTD9Ek_7.py
193
3.84375
4
def sums_of_powers_of_two(n): lst = [] while n > 0: x = 0 while 2**x <= n: x += 1 lst += [2**(x - 1)] n -= 2**(x - 1) return lst[::-1]
048f429c40f07ad007becbcebc7bc1f7a6d47a39
daniel-reich/ubiquitous-fiesta
/Cp3JRpooAqfA4kGkv_11.py
395
3.65625
4
def node_type(_N, _P, n): all = [x for x in _N] if n not in all: return 'Not exist' else: for i in _P: all.append(i) for i in all: if ((i == n) and(i in _N) and(i not in _P)): return 'Leaf' if (i == n) and(_P[_N.index(i)] == -1): return 'Root' if (i == n) and(i in _P) and (i in _N) and (_P[_N.index(i)] != -1): return 'Inner'
af049c8e69a4a83e53fbf7819469f806cbf079b2
daniel-reich/ubiquitous-fiesta
/RuwpKTa8grNSQkqX5_10.py
562
3.546875
4
def gcd(x, y): while y: x, y = y, x % y return x ​ ​ def fractions(d): p, r = d.find("."), d.find("(") whole = (int(d[:p]), 1) dec = (int(d[p + 1:r]), 10 ** (r - p - 1)) if r - p > 1 else (0, 1) rep = (int(d[r + 1:-1]), (10 ** (len(d) - r - 2) - 1) * 10 ** len(d[p + 1:r])) rep = [i / gcd(rep[1], rep[0]) for i in rep] e = dec[1] * rep[1] / gcd(dec[1], rep[1]) f = [whole[0] * e + dec[0] * e / dec[1] + rep[0] * e / rep[1], e] return str(int(f[0] / gcd(f[1], f[0]))) + "/" + str(int(f[1] / gcd(f[1], f[0])))
bdbb8172b4a5a933af550c33ac0c0cec962c154b
daniel-reich/ubiquitous-fiesta
/4QLMtW9tzMcvG7Cxa_20.py
311
3.578125
4
def resistance_calculator(resistors): l=resistors.copy() for i in l: if i==0: resistors.remove(i) if len(resistors)==0: return [0,0] if len(resistors)<len(l): return [0,sum(l)] return [round(1/(sum([1/i for i in resistors])),2),round(sum(resistors),2)]
73c695768d23c2aca48821348725f0f6672e50f5
daniel-reich/ubiquitous-fiesta
/tX5ZhY5EkduHAPZBh_21.py
207
3.65625
4
import numpy as np def nearest_element(n, lst): m = np.min(abs(np.array(lst)-n)) el = [] for i in range(0,len(lst)): if abs(n-lst[i]) <= m: el.append(lst[i]) return lst.index(np.max(el))
15ac6aa3b9fda93cd94b74208f66ccf5925a88bb
daniel-reich/ubiquitous-fiesta
/CD2fqbytBuXrbqJkL_3.py
194
3.5
4
def can_build(txt1, txt2): txt1 = txt1.replace(' ', '') txt2 = txt2.replace(' ', '') for letter in txt1: if txt1.count(letter) > txt2.count(letter): return False return True
4f1a963f053694fd971d6c70fc93ce664eb9e5e2
daniel-reich/ubiquitous-fiesta
/pn7QpvW2fW9grvYYE_12.py
115
3.5625
4
def find_fulcrum(lst): for i, l in enumerate(lst): if sum(lst[:i]) == sum(lst[i+1:]): return l return -1
1933f5cc1502fe8d27bda2d82d02e529e0e51908
daniel-reich/ubiquitous-fiesta
/a7WiKcyrTtggTym3f_16.py
96
3.53125
4
def lcm(a,b): i = max(a,b) while True: if not (i%a or i%b): return i i += 1
d1ddd89b28fb25ab60886c5e0d05ae6f434ee2d0
daniel-reich/ubiquitous-fiesta
/5Q2RRBNJ8KcjCkPwP_24.py
673
3.75
4
def tic_tac_toe(inputs): for i in range(0, 3): if all(inputs[i][j] == inputs[i][0] for j in range(1, 3)): return "Player 1 wins" if inputs[i][0] == "X" else "Player 2 wins" for j in range(0, 3): if all(inputs[i][j] == inputs[0][j] for i in range(1, 3)): return "Player 1 wins" if inputs[i][0] == "X" else "Player 2 wins" if all(inputs[i][i] == inputs[0][0] for i in range(1, 3)): return "Player 1 wins" if inputs[0][0] == "X" else "Player 2 wins" if all(inputs[i][2-i] == inputs[0][2] for i in range(1, 3)): return "Player 1 wins" if inputs[0][2] == "X" else "Player 2 wins" return "It's a Tie"
62eade2a91d0df4e95e38a7a6fca5f6b90bf085b
daniel-reich/ubiquitous-fiesta
/voxWDZ9NSv8CXifec_13.py
577
4
4
def lemonade(bills): bank = [] for i in bills: if i==5: bank.append(5) elif i==10: if 5 in bank: bank.append(10) bank.remove(5) else: return False else: if 5 in bank and 10 in bank: bank.append(20) bank.remove(5) bank.remove(10) elif bank.count(5)==3: bank.append(20) bank = sorted(bank)[3:] else: return False return True
05045463e61e329fbd118a71a0d4ca1c14ea80a4
daniel-reich/ubiquitous-fiesta
/f6LeKowjWQHm5637D_12.py
139
3.609375
4
def cap_to_front(s): up = '' low = '' for ch in s: if ch.isupper(): up += ch else: low += ch return up + low
bed0c5e150a851ea52ce1f8f694625b8edf4f2b8
daniel-reich/ubiquitous-fiesta
/BpKbaegMQJ5xRADtb_1.py
381
3.859375
4
def is_prime(n): return n > 1 and all(n % m for m in range(2, int(n ** 0.5) + 1)) ​ def is_unprimeable(num): if is_prime(num): return "Prime Input" ​ primes = [] s = str(num) ​ for d in range(10): for i in range(len(s)): n = int(s[:i] + str(d) + s[i + 1:]) if is_prime(n): primes.append(n) ​ return sorted(primes) or "Unprimeable"
69fd0e96dcf805da8182e9da4a8692ec2869e719
daniel-reich/ubiquitous-fiesta
/yYE8bJ5jhJgAoc5ir_11.py
286
3.625
4
def bugger(num): if len(str(num)) == 1: return 0 count = 0 while len(str(num)) > 1: num_str = list(str(num)) for i in range(0, len(num_str) - 1): num_str[i] = num_str[i] + '*' num = eval(''.join(num_str)) count = count + 1 print(num) return(count)
ccd3d64581ef1659f87bd40563c65928b36f2935
daniel-reich/ubiquitous-fiesta
/mJB9CYyGsADLQPjnx_18.py
118
3.578125
4
def first_non_repeated_character(txt): l=[i for i in txt if txt.count(i)==1] return l[0] if len(l)>0 else False
06331f6eda948d7fb8adc5c3cd620ad00a43b2a1
daniel-reich/ubiquitous-fiesta
/JBkfqYW4iYwmgvwTf_7.py
144
3.671875
4
def is_prime(num): nums = range(2,10) for i in nums: if i != num: if num%i == 0 or num == 1: return False return True
bf4f0975ef4b2b0c85c610eaa1d6a95214f4194b
daniel-reich/ubiquitous-fiesta
/K7NbqZBYD5xzZLro9_0.py
207
3.5
4
def digits_sum(start, stop, a=0): import sys sys.setrecursionlimit(100000000) if start == stop+1: return a else: b=sum(int(i) for i in str(start)) return digits_sum(start+1, stop, a+b)
a10cb445b77d62639607e16ac6f1b07368d43c65
daniel-reich/ubiquitous-fiesta
/BpKbaegMQJ5xRADtb_7.py
513
3.828125
4
def is_unprimeable(num): lst = [] if is_prime(num): return 'Prime Input' num = str(num) for i in range(len(num)): for j in range(0, 10): if is_prime(int(num[:i]+str(j)+num[i+1:])): lst.append(int(num[:i]+str(j)+num[i+1:])) return 'Unprimeable' if len(lst) < 1 else sorted(lst) ​ def is_prime(num): if num < 2: return False for i in range(2, num//2 + 1): if num % i == 0: return False return True
cab81a31b8c4d20b54de79c69069f8e0be4f0cc8
daniel-reich/ubiquitous-fiesta
/HTaZiWnsCGgehpgdr_1.py
242
3.515625
4
def license_plate(s, n): tmp = [i.upper() for i in s if i != '-'] if n == 2 or 3 or 4: indx = n while indx < len(tmp): tmp.insert((len(tmp) - indx), '-') indx += (n + 1) return ''.join(tmp) else: return s
dc45edc6cdeb5a3b0a54d46b782f6a2f53e492ef
daniel-reich/ubiquitous-fiesta
/frRRffQGSrPTknfxY_22.py
89
3.53125
4
def digit_count(n): n = str(n) return int(''.join(str(n.count(x)) for x in n))
a94ba1214830e27e9229216586e7118e97779373
daniel-reich/ubiquitous-fiesta
/yXipH35Xv4cBa8pnm_13.py
203
3.5625
4
def microwave_buttons(time): if time == '00:00': return 1 if time == '00:30': return 2 if time[0:2] == '00' or int(time[0:2]) < 10: return 3 if int(time[0:2]) >= 10: return 5
77b543bf3d5d3d6f7de534ccdf3f43388d78cf5a
daniel-reich/ubiquitous-fiesta
/mHRyhyazjCoze5jSL_13.py
199
3.765625
4
def double_swap(txt, c1, c2): res = [] for char in txt: if char == c1: res.append(c2) elif char == c2: res.append(c1) else: res.append(char) return ''.join(res)
aed73910775e269fd72b896c00bdc3dd55288fa8
daniel-reich/ubiquitous-fiesta
/jwiJNMiCW6P5d2XXA_17.py
178
3.578125
4
def does_rhyme(txt1, txt2): w1, w2 = txt1.split()[-1].lower(), txt2.split()[-1].lower() f = lambda x: sorted([item for item in x if item in 'aeiou']) return f(w1)==f(w2)
f6cc3ecaf11e9f8907413c478d41c9ee80fa6e7d
daniel-reich/ubiquitous-fiesta
/6cj6i2DACHTbtNnCD_2.py
138
3.578125
4
def two_product(lst, n): for i in lst: for x in range(len(lst)-1): if i*lst[x]==n: return sorted([i,lst[x]]) None
31e5521f56a4056841bf1745ea24549f1e018057
daniel-reich/ubiquitous-fiesta
/2C23JH5cC4pfnCKvi_5.py
267
3.5
4
def check_flush(table, hand): suits = [card[-1] for card in table] suits_hand = [card[-1] for card in hand] for el in suits: if suits.count(el) >= 3: diff = 5-suits.count(el) if suits_hand.count(el) >= diff: return True return False
689d451b4b13ffd618353a8b1db0feb8c2d66b9f
daniel-reich/ubiquitous-fiesta
/LDQvCxTPv4iiY8B2A_9.py
127
3.53125
4
def same_upsidedown(ntxt): return "".join(["6" if i=="9" else "9" if i=="6" else "0" for i in str(ntxt)][::-1])==str(ntxt)
b5513a6271fd97d43beeac34e12ce10360cadf23
daniel-reich/ubiquitous-fiesta
/63apGxfHchZDqJyw5_1.py
201
3.5625
4
def operation(num1, num2): dd = {(num1+num2): 'added', (num1-num2): 'subtracted', (num1*num2): 'multiplied', (num1/num2): 'divided'} if 24 in dd.keys(): return dd[24] else: return None
e02edad7d05831cb865d46199a89444773c61edf
daniel-reich/ubiquitous-fiesta
/yfooETHj3sHoHTJsv_15.py
160
3.75
4
def is_same_num(num1, num2): if(num1==num2): return True else: return False a=is_same_num(4, 8) print(a) b=is_same_num(8, 8) print(b)
6e137de52bcded43ede83dbc8ac0749ec6bdbc79
daniel-reich/ubiquitous-fiesta
/DGK42TmQiocZqifxi_1.py
152
3.5
4
def reverse_complement(input_sequence): rnr = {'A': 'U', 'U': 'A', 'G': 'C', 'C': 'G'} return ''.join([rnr[c] for c in input_sequence][::-1])
c2809638375d85c57a407c89b4d9ea254dd43a46
daniel-reich/ubiquitous-fiesta
/JPfqYkt6KGhpwfYK7_1.py
183
3.65625
4
def replace_the(n): n = n.lower().split() return' '.join('an'if n[i]=='the'and n[i+1][0]in'aeiou'else'a'if n[i]=='the'and n[i+1][0]not in'aeiou'else n[i]for i in range(len(n)))
ed6b9b023ab6d2a5828b765323d4f77563dde403
daniel-reich/ubiquitous-fiesta
/bKfxE7SWnRKTpyZQT_1.py
144
4
4
def replace_vowel(word): v = {'a': '1', 'e': '2', 'i': '3', 'o': '4', 'u': '5'} return "".join([i if i not in v else v[i] for i in word])
cacd8d998eb2534696928cdf7251fe5d4612e40b
daniel-reich/ubiquitous-fiesta
/xmyNqzxAgpE47zXEt_10.py
147
3.984375
4
def is_alphabetically_sorted(sentence): return any([all([i[j+1]>=i[j] for j in range(len(i)-1)]) for i in sentence[:-1].split() if len(i)>=3])
29b49d2fa2bcc0198869ed6524dc3cd4cf2bcd26
daniel-reich/ubiquitous-fiesta
/7jcWz9Kmr4rTSwdjK_19.py
167
3.953125
4
def prime_factorize(num): primes = [] x = 2 while x <= num: if num % x == 0: num //= x primes.append(x) else: x += 1 return primes
5c5a379b6fc68e547dff08bed8ba874735b982bb
daniel-reich/ubiquitous-fiesta
/9YmYQTdPSdr8K8Bnz_15.py
115
3.609375
4
def unique_lst(lst): lst1=[] for i in lst: if i >0 and i not in lst1: lst1.append(i) return lst1
9c53146b5bb7e212b4a3ef1b3aeb1110e00c2b19
daniel-reich/ubiquitous-fiesta
/fRZMqCpyxpSgmriQ6_5.py
248
3.578125
4
def sorting(s): li = list(s) li.sort(key=sorter) return ''.join(li) def sorter(elem): if elem.isalpha(): if elem.islower(): return ord(elem.upper()) - 0.5 else: return ord(elem) else: return ord(elem) + 43
4f1a5462405df36b9d477af73c5db5458e9c6124
daniel-reich/ubiquitous-fiesta
/xXenZR2hWFE7Jb9vR_9.py
818
4.03125
4
def is_isomorphic(s, t): s.lower();t.lower(); alphabet={};values=[]; for i in range(len(s)): # if the character in string s does not point to anything yet, and the character in string t is not pointed by anything, #create a mapping from s[i] to t[i] if(s[i] not in alphabet): if(t[i] not in values): alphabet.update({s[i]:t[i]}); values.append(t[i]); else: return False; # if the character in string s point to a character in t that has been pointed, return false elif(alphabet[s[i]] != t[i]): return False; # if there is already a mapping from s[i], but not to t[i],this means that two strings are not isomorphic #print(alphabet) return True;
ba23eb1f588dc180543b958d8feb2ee3ec2f34de
daniel-reich/ubiquitous-fiesta
/BYDZmaM6e4TQrgneb_2.py
107
3.5625
4
def fibFast(num): lst = [0,1] while len(lst)<=num: lst.append(lst[-2]+lst[-1]) return lst[num]
72740af6b97b9ca0e2def89e4afb0d7fddfb3646
daniel-reich/ubiquitous-fiesta
/zgu7m6W7i3z5SYwa6_14.py
117
3.5625
4
def is_equal(lst): if eval('+'.join(str(lst[0]))) == eval('+'.join(str(lst[1]))): return True return False
33701a73b669e49c513d32957c3e9a449be8ad25
daniel-reich/ubiquitous-fiesta
/dBqLSk6qvudNdZrSx_11.py
182
3.71875
4
def is_boiling(temp): if int(temp[:len(temp)-1]) >= 100 and temp[-1] == 'C':return True elif int(temp[:len(temp)-1]) >= 212 and temp[-1] == 'F':return True else:return False
88b08f253f89079d2055ca809f990b4bba66c970
daniel-reich/ubiquitous-fiesta
/kgMEhkNNjRmBTAAPz_19.py
241
4.125
4
def remove_special_characters(txt): l = [] for item in txt: if item in ['-','_',' '] or 'A'<=item<= 'Z'or 'a'<=item<='z' or '0'<=item<='9' : l.extend(item) print(l) return ''.join([item for item in l])
72934f94f357191b4e5fe0a35c053d1d02926163
daniel-reich/ubiquitous-fiesta
/hjZTbJNzKiSxTtbik_8.py
171
3.59375
4
def sort_by_string(lst, txt): x = [] for i in range(len(txt)): for j in range(len(lst)): if lst[j].startswith(txt[i]): x.append(lst[j]) return x