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
fcc3c5ca37116aa322b7208413ee7aaf08d85440
daniel-reich/ubiquitous-fiesta
/cEzT2e8tLpwYnrstP_4.py
113
3.515625
4
def swap_d(k, v, swapped): if swapped == True: return dict(zip(v, k)) else: return dict(zip(k, v))
c32ba7a3d4637b253d2a5a7c938b0209956357fb
daniel-reich/ubiquitous-fiesta
/xmwdk2qwyZEt7ph49_19.py
134
3.5
4
def get_length(lst): t = 0 for x in lst: if isinstance(x, list): t += get_length(x) else: t += 1 return t
fc4fa1106cb3c121ff796c5e50c553bdfbf8bad2
daniel-reich/ubiquitous-fiesta
/ZWEnJEy2DoJF9Ejqa_2.py
130
3.546875
4
def edabit_in_string(txt): i=0 for c in txt: if c=='edabit'[i]: i+=1 if i>5: return 'YES' return 'NO'
6605639db844dae09e71fc5f455b85e747f40ad3
daniel-reich/ubiquitous-fiesta
/wL2YJua2eBJfs4yGa_7.py
226
3.640625
4
def babbage(n): for i in range(1,n+1): if n == 269696 : return "Babbage was {}!".format("correct" if str(i**2).endswith(str(n)) else "incorrect" ) else: if str(i**2).endswith(str(n)): return i
8170e2208619a223458635c9d3bfd004049f5665
daniel-reich/ubiquitous-fiesta
/ThvNE5FZRX6JbGoTo_18.py
173
3.515625
4
def inverter(s, t): arr = s.lower().split(' ') if t == 'P': return ' '.join(arr[::-1]).capitalize() return ' '.join(i[::-1] for i in arr).capitalize()
08e851b938ef5cc1703b2260c8e1a7ddde0a4124
daniel-reich/ubiquitous-fiesta
/4AzBbuPLxKfJd7aeG_9.py
265
3.703125
4
def pairs(s): for i in range(0, len(s)-1, 2): yield ord(s[i]), s[i+1] yield ord(s[i+1]), s[i] ​ def encrypt(key, message): mapping = {} for a, b in pairs(key): if a not in mapping: mapping[a] = b return message.translate(mapping)
ec898157461e03f8da8566a4d3612f879161766b
daniel-reich/ubiquitous-fiesta
/wBuZ2Qp9okzGeZc6e_6.py
179
3.609375
4
def first_place(road): if road: if [x for x in road if x.isalpha()]: return [x for x in road if x.isalpha()][-1] else: return None else: return None
69d57c2ce1e6751b5fe8f7ab8b0d9a8d07842367
daniel-reich/ubiquitous-fiesta
/voxWDZ9NSv8CXifec_8.py
297
3.75
4
def lemonade(bills): f,t=0,0 for b in bills: if b==5: f+=1 elif b==10: if not f: return False f-=1 t+=1 else: if not f or (f<3 and not t): return False elif t>1: t-=1 f-=1 else: f-=3 return True
16f5bb90736c8959902b6134b7218e2a81e996c6
daniel-reich/ubiquitous-fiesta
/SFAjxGWk9AbfwbXFN_8.py
307
3.78125
4
import math ​ def primes_below_num(n): list = [] i = 0 for j in range(2,n+1): for k in range(2,math.floor(math.sqrt(j))+1): if j % k == 0: i += 1 if i == 0: list += [j] i = 0 else: i = 0 return list
fba465adcd5c9430f0ee55d349860f2fa124560c
daniel-reich/ubiquitous-fiesta
/v2k5hKnb4d5srYFvE_6.py
300
3.796875
4
from itertools import product d = { "2": "abc", "3": "def", "4": "ghi", "5": "jkl", "6": "mno", "7": "pqrs", "8": "tuv", "9": "wxyz" } def letters_combinations(digits): combos = list(product(*([chr for chr in d[n]] for n in digits))) return set(''.join(pair) for pair in combos if len(pair)>0)
f2077145d0d77c1a3664841782b3039d09928f03
daniel-reich/ubiquitous-fiesta
/hoxv8zaQJNMWJqnt3_14.py
165
3.53125
4
def is_heteromecic(n, i=0): # your recursive solution here if i*(i+1) == n: return True if n == i: return False i+=1 return is_heteromecic(n, i)
6d884d95a6414500c8973949e40a4bde0bfacac9
daniel-reich/ubiquitous-fiesta
/r9y4yrSAGRaqTT7nM_3.py
331
3.71875
4
def find_missing(l): if not l: #Check if l is None return False ​ subLstLengths = sorted([len(i) for i in l]) ​ if not all(subLstLengths): #Check if l contains [] return False ​ for x in range(min(subLstLengths),max(subLstLengths)+1): if x not in subLstLengths: return x
7fee6c752995c9461affee79baa27443c23db9aa
daniel-reich/ubiquitous-fiesta
/kKFuf9hfo2qnu7pBe_4.py
434
4.03125
4
def is_prime(list_of_primes, number): first = 0 last = len(list_of_primes)-1 found = False while first <= last and not found: middle = (first + last)//2 if list_of_primes[middle] == number: found = True else: if number < list_of_primes[middle]: last = middle - 1 else: first = middle + 1 return "yes" if found else "no"
3ce2ef5fbdc824f767ed80fce5e77934b5160201
daniel-reich/ubiquitous-fiesta
/xFKwv7pAzEdNehwrt_16.py
295
3.765625
4
BRACKETS = { ')': '(', ']': '[', '>': '<', '}': '{' } ​ def bracket_logic(xp): stack = [] for c in xp: if c in BRACKETS.values(): stack.append(c) elif c in BRACKETS.keys(): if stack[-1] != BRACKETS[c]: return False stack.pop() ​ return not stack
4ef7350c7e197189e4483a59a7fbd367568e5b9b
daniel-reich/ubiquitous-fiesta
/suhHcPgaKdb9YCrve_4.py
210
4.0625
4
def even_or_odd(s): m=list(map(int,s)) ms=sum(x for x in m if x%2)-sum(x for x in m if not x%2) return ['Even and Odd are the same','Odd is greater than Even','Even is greater than Odd'][(ms>0)-(ms<0)]
9886ee2e98e33530f3d339e7ae8a4901083fa4d8
daniel-reich/ubiquitous-fiesta
/bPHcgMpkf9WvbwbAo_5.py
130
3.625
4
def format_phone_number(lst): lst = ''.join(str(l) for l in lst) return '({}) {}-{}'.format(lst[:3], lst[3:6], lst[6:])
45deaa97e3fab7b4fda8432487841ace8b2bf130
daniel-reich/ubiquitous-fiesta
/JgYPQrYdivmqN4KKX_0.py
460
3.734375
4
def BMI(weight, height): weight = weight.replace('pounds', '*0.453592').replace('kilos', '*1') height = height.replace('inches', '*0.0254').replace('meters', '*1') bmi = round(eval(weight) / eval(height)**2, 1) ​ if bmi < 18.5: status = 'Underweight' elif bmi < 25: status = 'Normal weight' elif bmi < 30: status = 'Overweight' else: status = 'Obesity' ​ return '{} {}'.format(bmi, status)
26b05812fa48c4e0d0600e379459eb2bde517f11
daniel-reich/ubiquitous-fiesta
/zNNtsPBCE5FFXW7wn_19.py
440
3.640625
4
def empty_values(lst): lst2 = [] for i in lst: if type(i) == int: lst2.append(0) elif type(i) == float: lst2.append(0.0) elif type(i) == str: lst2.append('') elif type(i) == bool: lst2.append(False) elif type(i) == list: lst2.append([]) elif type(i) == tuple: lst2.append(()) elif type(i) == set: lst2.append(set()) else: lst2.append(None) return lst2
b76fbf1b225929634336059f1e5db26883171361
daniel-reich/ubiquitous-fiesta
/NrWECd98HTub87cHq_10.py
730
4.09375
4
class Rectangle: def __init__(self, rect): x, y, width, height = rect[:] self.left = x self.right = x + width self.bottom = y self.top = y + height ​ ​ def overlapping_rectangles(rect1, rect2): """Area of Overlapping Rectangles""" r1 = Rectangle(rect1) r2 = Rectangle(rect2) # Coordinates of the intersected rectangle left = max(r1.left, r2.left) right = min(r1.right, r2.right) bottom = max(r1.bottom, r2.bottom) top = min(r1.top, r2.top) # If they are not overlapping if left > right or bottom > top: return 0 # Return the area (which is base * height) return ((right - left) * (top - bottom))
d8afc6d590b9981de9e1634870dde862e836601f
daniel-reich/ubiquitous-fiesta
/ZWEnJEy2DoJF9Ejqa_5.py
151
3.546875
4
def edabit_in_string(txt): strn,cur = "edabit",0 for x in txt: if x == strn[cur]:cur += 1 if cur == len(strn):return "YES" return "NO"
5108996ad46624b70775c349bf34488a03998671
daniel-reich/ubiquitous-fiesta
/veFgC7QFEBmG6xE3G_8.py
226
3.609375
4
def is_smooth (sentence) : sentence = sentence.split(' ') ​ for word in range(len(sentence)-1) : if sentence[word][-1].lower() != sentence[word+1][0].lower() : return False return True
fcb29d708caae2a663db221843088287ea21b049
daniel-reich/ubiquitous-fiesta
/mDuDhhMWrdHJSGdtm_17.py
240
3.921875
4
def is_exactly_three(n): sqrt = n**.5 if sqrt == round(sqrt) and n != 1: is_three = True for i in range(2,int(sqrt)): if sqrt%i == 0: is_three = False break else: is_three = False return is_three
81371d796f4712bc00a72f73768b066c78d2d5bb
daniel-reich/ubiquitous-fiesta
/zW9JME7XNew4tgCCE_23.py
131
3.546875
4
def reversible_inclusive_list(start,end): return list(range(start,end+1)) if start < end else list(range(end,start+1))[::-1]
26b2d39cb423be774a2bb8110248590200f65de2
daniel-reich/ubiquitous-fiesta
/dBBhtQqKZb2eDERHg_8.py
559
3.921875
4
def numberSequence(n, odd=True, res=None): if res is None: if n < 1: return '-1' if n == 1: return '1' if n == 2: return '1 1' odd = n % 2 if odd: n = (n + 1) // 2 else: n //= 2 res = '{}'.format(n) n -= 1 if n > 1: res += ' {}'.format(n) elif n == 1: if odd: return res + ' 1 ' + res[::-1] else: return res + ' 1 1 ' + res[::-1] return numberSequence(n - 1, odd, res)
012046dca8a3777334918757f4720b909aa5499c
daniel-reich/ubiquitous-fiesta
/uusYhAkGc9W2ufBwc_2.py
1,111
3.578125
4
def system_escape_velocity(planet): ​ class Planet: k = 0.2929 grav_con = 6.67e-11 def escape_from_sun( ve1, ve2): from math import sqrt return sqrt((ve2 * Planet.k) ** 2 + ve1 ** 2) ​ def __init__(self, name, ve1, ve2): self.name = name self.ve1 = ve1 self.ve2 = ve2 self.escape = Planet.escape_from_sun(self.ve1, self.ve2) ​ def compare(self, other): return self.escape / other.escape Mercury = Planet('Mercury', 4.25, 67.7) Venus = Planet('Venus', 10.36, 49.5) Earth = Planet('Earth', 11.186, 42.1) Mars = Planet('Mars', 5.03, 34.1) Jupiter = Planet('Jupiter', 60.20, 18.5) Saturn = Planet('Saturn', 36.09, 13.6) Uranus = Planet('Uranus', 21.38, 9.6) Neptune = Planet('Neptune', 23.56, 7.7) ​ planet = eval(planet) ​ return 'The escape velocity from the system {planet}/Sun is {pev} km/s.\nThe escape velocity from the system {planet}/Sun is {perc} times the escape velocity from the system Earth/Sun.'.format(planet = planet.name, pev = round(planet.escape,1), perc = round(planet.compare(Earth),1))
a46cf0ad2a09a6834f6357202e440dae1ffb500e
daniel-reich/ubiquitous-fiesta
/YTf8DZbTkzJ3kizNa_5.py
510
3.84375
4
def isPrime(number): isAPrimeNumber = False for i in range(2, number): if (number % i) == 0: isAPrimeNumber = False break else: isAPrimeNumber = True return isAPrimeNumber def moran(number): numberStr = str(number) sumOfDigits = 0 for i in numberStr: sumOfDigits += int(i) if number % sumOfDigits == 0: if isPrime(int(number/sumOfDigits)) == True: return "M" else: return "H" else: return "Neither"
75f0737e4f50ba2788f75695bddf23615f626278
daniel-reich/ubiquitous-fiesta
/H3t4MkT9wGdL9P6Y3_3.py
103
3.984375
4
def oddish_or_evenish(num): return 'Evenish' if sum(int(i) for i in str(num))%2 == 0 else 'Oddish'
d631b8b4c8d48f99edceb85f162319e1b6c00633
daniel-reich/ubiquitous-fiesta
/g3BokS6KZgyYT8Hjm_24.py
99
3.703125
4
def shift_to_left(x, y): # recursive code here return x if not y else 2*shift_to_left(x,y-1)
a821d657d236e7a756de5678164bcc07e0e151f2
daniel-reich/ubiquitous-fiesta
/GAbxxcsKoLGKtwjRB_3.py
258
3.5
4
def sum_primes(lst): sums = [] emtyd = [] if lst == emtyd: return None for i in lst: for x in range(2, i): if i % x == 0: break else: if i != 1: sums.append(i) a = 0 for n in sums: a += n return a
cb9e7d3bfdb0cd13645c1f4eebc7667c9ae9b4e0
daniel-reich/ubiquitous-fiesta
/oepiudBYC7PT7TXAM_14.py
434
3.640625
4
def parse_roman_numeral(num): romandict = {"I":1,"V":5,"X":10,"L":50,"C":100,"D":500,"M":1000} def lettercalc(focus_letter,comp_letter): if romandict.get(focus_letter)<romandict.get(comp_letter): return romandict.get(focus_letter)*-1 else: return romandict.get(focus_letter) i=0 value=0 while i<len(num)-1: value+=lettercalc(num[i],num[i+1]) i+=1 value+=romandict.get(num[-1]) return value
7750811fb5df33c9534a2600a8a4326150231c8d
daniel-reich/ubiquitous-fiesta
/2rQcGmSYvXRtxSuHn_6.py
393
3.5
4
def rotate_matrix(mat, turns=1): m, n, turns = len(mat), len(mat[0]), turns%4 if turns == 3: return [[mat[r][c] for r in range(m)] for c in range(n-1, -1, -1)] elif turns == 2: return [row[::-1] for row in mat[::-1]] elif turns == 1: return [[mat[r][c] for r in range(m-1, -1, -1)] for c in range(n)] else: return [row[::] for row in mat]
c6f2e6387e4c45caa53a9680c7b641c7f3fa39ce
daniel-reich/ubiquitous-fiesta
/nfWirHJzNRBMAp9Df_9.py
136
3.640625
4
def hamming_distance(txt1, txt2): count = 0 for n in range(len(txt1)): if txt1[n] != txt2[n]: count += 1 return count
588e8ce37fd842f9dbbe11f0fe29675372550df5
daniel-reich/ubiquitous-fiesta
/5q3FdCvrXtwQRoGmP_19.py
189
3.59375
4
def count_towers(towers): n=0 m=[] for i in towers: i=' '.join(i) i = i.split(' ') n=i.count('##') n=str(n) m.append(n) n=[int(k) for k in m] return max(n)
fa7d7140eb750314c7525eee5b10331b647a95d3
daniel-reich/ubiquitous-fiesta
/aqDGJxTYCx7XWyPKc_17.py
102
3.53125
4
def squares_sum(n): s = [] for i in range(1, n+1): s.append(i**2) return sum(s)
b052fd0de0fb61e1bc9c74a1c591c2291f79f817
daniel-reich/ubiquitous-fiesta
/yPzfgnDsPWXwH7dMq_7.py
1,786
3.5
4
class Pagination: page_number = 0 ​ def __init__(self, items=[], pageSize=10): self.items = items self.pageSize = pageSize self.totalPages = divmod(len(items), pageSize)[0] if not divmod( len(items), pageSize)[1] else divmod(len(items), pageSize)[0] + 1 self.currentPage = 1 ​ def getItems(self): return self.items ​ def getPageSize(self): return self.pageSize ​ def getCurrentPage(self): return self.currentPage ​ def prevPage(self): if self.currentPage > 1: self.currentPage -= 1 return self return self ​ def nextPage(self): if self.currentPage != self.totalPages: self.currentPage += 1 return self return self ​ def firstPage(self): self.currentPage = 1 return self ​ def lastPage(self): self.currentPage = self.totalPages return self ​ def goToPage(self, page_number): self.page_number = int(page_number) if self.page_number >= self.totalPages: self.currentPage = self.totalPages return self elif self.page_number <= 2: self.currentPage = 1 return self else: self.currentPage = self.page_number return self ​ def getVisibleItems(self): self.page = [] self.pages = [] for self.item in self.items: if len(self.page) < self.pageSize: self.page.append(self.item) else: self.pages.append(self.page) self.page = [] self.page.append(self.item) self.pages += [self.page] return self.pages[self.currentPage - 1]
72ad34216051ba304d475a96dbe9fb6c8b5bfede
daniel-reich/ubiquitous-fiesta
/bfz7kTgPujtfcHR9d_5.py
402
3.9375
4
def x_pronounce(sentence): a = "" k = "" sentence += " " for letter in sentence: if letter != " ": a += letter else: if a == "x": k += "ecks" +" " elif a[0] == "x": k += ("z" + a[1:]) + " " elif a.count("x") > 0: k += (a[:a.index("x")] + "cks" + a[a.index("x")+1:]) + " " else: k += (a + " ") a = "" return k[:-1]
a7ebccdd2b5ffb581f16fb00a4019caf80782e9d
daniel-reich/ubiquitous-fiesta
/FT5Zd4mayPa5ghpPt_6.py
719
3.609375
4
hex = '0123456789abcdef' ​ def color_conversion(h): if type(h) == str: if any(x not in hex+'#' for x in h): return "Invalid input!" if h[0]=='#' and len(h)==7: return {'r':hex_to_num(h[1:3]), 'g':hex_to_num(h[3:5]), 'b':hex_to_num(h[5:7])} elif h[0]!='#' and len(h)==6: return {'r':hex_to_num(h[0:2]), 'g':hex_to_num(h[2:4]), 'b':hex_to_num(h[4:6])} else: return "Invalid input!" else: if all(0<=h[x]<256 for x in ['r','g','b']): return '#{}{}{}'.format(*[num_to_hex(h[x]) for x in ['r','g','b']]) else: return "Invalid input!" def hex_to_num(str): return hex.index(str[0])*16+hex.index(str[1]) def num_to_hex(n): return hex[n//16]+hex[n%16]
4b1fc26de8b0c0e6e3511a613e37a4245e092955
daniel-reich/ubiquitous-fiesta
/ivSPJNgW4ChfbrKbR_16.py
973
3.546875
4
top = { "O|": 0, "|O": 5 } bottom = { "|OOOO": 0, "O|OOO": 1, "OO|OO": 2, "OOO|O": 3, "OOOO|": 4 } ​ def splitList(array, charToSplit): indexSplit = array.index(charToSplit) bef = [] aft = [] ​ for i in range(0, indexSplit): bef.append(array[i]) ​ for j in range(indexSplit + 1, len(array)): aft.append(array[j]) ​ return [top["".join(bef)], bottom["".join(aft)]] ​ ​ def getSorobanDesign(soroban): ans = [] num = soroban[0] for i in range(0, len(num)): ans.append([]) ​ for line in soroban: for i in range(0, len(line)): ans[i].append(line[i]) ​ for array in ans: ans[ans.index(array)] = splitList(array, "-") ​ return ans ​ def soroban(design): array = getSorobanDesign(design) preAnswer = "" for _list in array: preAnswer += str(_list[0] + _list[1]) ​ answer = int(preAnswer) return answer
260999afa6c37c3d9154c916b2d39f74dbe1c30c
daniel-reich/ubiquitous-fiesta
/X8SvemhZykdgKj5uD_24.py
258
3.65625
4
def letter_at_position(n): string = list("abcdefghijklmnopqrstuvwxyz") if type(n) == float: if str(n).endswith(".0"): return string[int(n)-1] else: return "invalid" elif n <= 0: return "invalid" else: return string[n-1]
e8d1e200d58055eeef98ffbabee55d619553a32d
daniel-reich/ubiquitous-fiesta
/zXACKeaEzLK9XwBwp_23.py
232
3.625
4
def split_bunches(bunches): res = [] for b in bunches: print (b.items()) q = b["quantity"] while q >= 1: res.append({'name': b['name'], "quantity": 1}) q -= 1 return res
ff8b3bcc48a45a9829502473c4ddfd20d710c03b
daniel-reich/ubiquitous-fiesta
/H9gjahbSRbbGEpYta_12.py
204
3.671875
4
def multiply(n1, n2): Total = 0 Added = 0 Required = abs(n2) while (Added < Required): Total += n1 Added += 1 if (n2 < 0): return Total * -1 else: return Total
367ed594de31e413093d77b47eb0d42d79af121d
daniel-reich/ubiquitous-fiesta
/egWRSXEE8dbKujvHw_24.py
216
3.59375
4
def is_circle_collision(c1, c2): d = ((c1[1] - c2[1])**2 + (c1[2] - c2[2])**2) ds2 = d**.5 if ds2 == 0: return True l = ((c1[0])**2 - (c2[0])**2 + d) / (2 * ds2) return (c1[0] * c1[0]) - (l * l) >= 0
a89eae255f80f73bf3e0861044e6dd3d35a18a15
daniel-reich/ubiquitous-fiesta
/HWxNGdeoPxzievGa3_5.py
117
3.734375
4
def is_strange_pair(txt1, txt2): return txt1[0]==txt2[-1] and txt1[-1]==txt2[0] if txt1 and txt2 else txt1==txt2
f5b02827ebb0d6fdd6d5f25bf32b4c66448ab0a1
daniel-reich/ubiquitous-fiesta
/DjyqoxE3WYPe7qYCy_23.py
97
3.71875
4
def reverse_odd(txt): return ' '.join(x[::-1] if len(x) % 2 !=0 else x for x in txt.split())
095ca91b05b1391df493e2181237a1956657c50b
daniel-reich/ubiquitous-fiesta
/fRZMqCpyxpSgmriQ6_14.py
497
3.84375
4
import string ​ def sorting(s): init = sorted(s) numbers = [] no_digit = [] ​ # store numbers for i in init: if i.isdigit(): numbers.extend(i) ​ # remove numbers from original string for i in init: if not i.isdigit(): no_digit.extend(i) ​ first_sort = sorted(no_digit, key=string.ascii_letters.index) final = sorted(first_sort, key=str.lower) ​ # makes lists to string digit = "".join(numbers) new_s = "".join(final) return new_s+digit
e205de6a2e5804023307af1ae2881f9fa6872bc3
daniel-reich/ubiquitous-fiesta
/T4q8P8cxvBtaLPW4q_24.py
539
3.5625
4
def extract_primes(num): num_str = str(num) a = [] for i in range(len(num_str)): for j in range(len(num_str)-i): if num_str[j] != '0': #print(num_str[j:j+i+1]) a.append(check_prime(num_str[j:j+i+1])) return sorted(list(filter(lambda b : b != 1, a))) ​ def check_prime(num): if int(num) == 1: return 1 elif int(num) == 0: return 1 else: for n in range(2,int(int(num)**0.5)+1): if int(num) % n == 0: return 1 return int(num)
feeb7cbc98bf67f32d290479ffb0f8d1c9a3c0b1
daniel-reich/ubiquitous-fiesta
/YcqAY72nZNPtvofuJ_17.py
186
3.65625
4
def quad_sequence(lst): n1,n2,n3 = lst[0], lst[1], lst[2] a = (n1 + n3 - 2 * n2)/2 b = n3 - a - n2 return [int(a * i**2 + b * i + n2) for i in range(len(lst)-1, 2*len(lst)-1)]
e8483cd351890396b12234bd525b1d1f06c74564
daniel-reich/ubiquitous-fiesta
/tRHaoWNaHBJCYD5Nx_5.py
325
3.53125
4
def same_letter_pattern(txt1, txt2): ​ if len(txt1) != len(txt2): return False codes = {} ​ for char1, char2 in zip(txt1, txt2): if char1 not in codes: codes[char1] = char2 else: if codes[char1] != char2: return False ​ return True
b1929c2438632952ffb229532242d73a713df56a
daniel-reich/ubiquitous-fiesta
/3JX75W5Xvun63RH9H_0.py
264
3.765625
4
def describe_num(n): adj=['brilliant','exciting','fantastic','virtuous','heart-warming','tear-jerking','beautiful','exhillarating','emotional','inspiring'] return 'The most {} number is {}!'.format(' '.join(adj[i] for i in range(len(adj)) if not n%(i+1)),n)
3688c65467d0af34c3b612bd849916d51efc3d98
daniel-reich/ubiquitous-fiesta
/iRvRtg2xxL9BnSEvf_14.py
379
3.71875
4
class Person: def __init__(self, name, like, hate): self.name = name self.like = like self.hate = hate ​ def taste(self, food): msg = self.name + ' eats the ' + food if food in self.like: return msg + ' and loves it!' if food in self.hate: return msg + ' and hates it!' return msg + '!'
8ee7d962def8fd57cf5d17b950203148bbff468e
daniel-reich/ubiquitous-fiesta
/mPpcATtDMYiegZ3Jw_6.py
120
3.609375
4
def right_triangle(x, y, z): a, b, c = sorted([x, y, z]) if a <= 0: return False return a**2 + b**2 == c**2
33d24d4c795c79706288c00531fa301708a97624
daniel-reich/ubiquitous-fiesta
/YA5sLYuTzQpWLF8xP_11.py
181
3.765625
4
def clean_up_list(lst): even=[] odd=[] for i in lst: i=int(i) if int(i)%2==0 : even=even+[i] else: odd=odd+[i] output=[even,odd] return output
ed0119ce20c4a7fbf268a3167348d885f20d06b0
daniel-reich/ubiquitous-fiesta
/hmt2HMc4XNYrwPkDh_21.py
146
3.75
4
def invert(s): if len(s)==1: return s.swapcase() else: return s[::-1][0].swapcase()+invert(s[:-1]) # your recursive solution here
97e62562d5f3d93cabe43a12998c6af7c7539d2b
daniel-reich/ubiquitous-fiesta
/temD7SmTyhdmME75i_6.py
78
3.609375
4
def to_boolean_list(word): return [(ord(i) + 1) % 2 == 0 for i in word]
3432e90b906a0c6259103f20f82993d53ee50df8
daniel-reich/ubiquitous-fiesta
/5h5uAmaAWY3jSHA7k_4.py
546
3.671875
4
def landscape_type(lst): mx, mn = max(lst), min(lst) pmx = lst.index(mx) pmn = lst.index(mn) # mountain if all(lst[i] >= lst[i-1] for i in range(1, pmx)) and \ all(lst[i] <= lst[i-1] for i in range(pmx+1, len(lst))): return "mountain" if mx not in (lst[0], lst[-1]) else "neither" # valley if all(lst[i] <= lst[i-1] for i in range(1, pmn)) and \ all(lst[i] >= lst[i-1] for i in range(pmn+1, len(lst))): return "valley" if mn not in (lst[0], lst[-1]) else "neither" return "neither"
fae3ae5dd943e97b25b8d1da9ef56f4cd010e7a4
daniel-reich/ubiquitous-fiesta
/82AvsFFQprj43XCDS_10.py
1,045
4.0625
4
def no_strangers(text): ''' Analyses text and returns 2 lists: acquaintances for words which occur 3 to 4 times, friends for those which occur 5+ times. Words are ordered by the order in which words first become acquaintances or friends. ''' import re ​ def rank(words, min_val, max_val, idx): ''' Returns a list containing the words in words whose frequency lie between min_val and max_val, sorted by the position at idx. ''' selected = {word: [] for word in words if min_val <= words.count(word) <= max_val} for i, word in enumerate(words): if word in selected: selected[word].append(i) # store locations of selected words ​ return sorted((word for word in selected), key=lambda x: selected[x][idx]) ​ words = [word.lower() for word in re.split("[^A-Za-z0-9']+", text)] words = [word for word in words if word != ''] # remove empty strings return [rank(words, 3, 4, 2), rank(words, 5, len(words)+1, 4)]
d6875c000a695a71cdb851148bce1bd2f48339ea
daniel-reich/ubiquitous-fiesta
/94DMDTYe89i6TLCZh_23.py
273
3.578125
4
def get_languages(num): langs = ["C#", "C++", "Java", "JavaScript", "PHP", "Python", "Ruby", "Swift"] final = [] bin_str = bin(num)[2:] bin_num = int(bin_str, 2) for i in range(len(langs)): if bin_num & (1 << i): final.append(langs[i]) return final
9fed74899ba431054739576740d37080e2612d32
daniel-reich/ubiquitous-fiesta
/WixXhsdqcNHe3vTn3_5.py
281
3.609375
4
def is_prime(n): for i in range(2,int(n**0.5)+1): if n % i == 0: return False return False if n == 1 else True ​ def how_bad(n): ones = bin(n).count('1') res = ["Odious"] if ones % 2 == 1 else ["Evil"] return res + ["Pernicious"] if is_prime(ones) else res
3a1b08967c08843bf2b4484122822dea02ea38c9
daniel-reich/ubiquitous-fiesta
/JBkfqYW4iYwmgvwTf_14.py
375
4.0625
4
def is_prime(num): factor_list = [] for factors in range(1 , num + 1): # print(num , factors) if(num % factors == 0): # print(num, "is divisible by" , factors) factor_list.append(factors) #if there are only two elements in the factor list if(len(factor_list) == 2): return True else: return False
db1d302fc7cdab03212c2ca48c1b92d83854dad5
daniel-reich/ubiquitous-fiesta
/QCgDtyfajCT4PGhFK_7.py
161
3.828125
4
def prime_factorization(number): result = [] for n in range(2,number): while number % n == 0: result.append(n) number /= n return result
2c82abf2931780b724292db21dee8c9eb64252c1
daniel-reich/ubiquitous-fiesta
/fRjfrCYXWJAaQqFXF_11.py
775
3.84375
4
import math def primorial(n): if n ==1: return 2 elif n == 2: return 6 elif n==3: return 30 else: return 9699690 primes=[] marked=[False]*(int(n/2)+1); # Main logic of Sundaram. Mark all numbers which # do not generate prime number by doing 2*i+1 for i in range(1,int((math.sqrt(n)-1)/2)+1): for j in range(((i*(i+1))<<1),(int(n/2)+1),(2*i+1)): marked[j] = True; # Since 2 is a prime number primes.append(2); # Print other primes. Remaining primes are of the # form 2*i + 1 such that marked[i] is false. for i in range(1,int(n/2)): if (marked[i] == False): primes.append(2*i + 1); xanc=1 print(primes) for prime in primes: xanc *= prime return xanc
8aba364eac36c7359f299fc0f593d37a0e3c2276
daniel-reich/ubiquitous-fiesta
/76pRYoqrmEQQtFAME_24.py
357
3.671875
4
def is_astonishing(num): num = str(num) for i in range(1, len(num)): prev_a = int(num[:i]) prev_b = int(num[i:]) a, b = (prev_b, prev_a) if prev_a > prev_b else (prev_a, prev_b) sum_ab = (b * (b + 1) / 2) - (a**2 - a) / 2 if sum_ab == int(num): return "AB-Astonishing" if prev_a < prev_b else "BA-Astonishing" return False
ad87e3599cd1a7d92441b5c2184f27f399b8ae13
daniel-reich/ubiquitous-fiesta
/jwzAdBnJnBxCe4AXP_1.py
112
3.53125
4
def rearranged_difference(num): digits = ''.join(sorted(str(num))) return int(digits[::-1]) - int(digits)
f70147a1835b66f69475f75569ae0e04220062dd
daniel-reich/ubiquitous-fiesta
/zE37mNeG4cn6HesaP_24.py
199
3.625
4
def max_ham(s1, s2): if set(s1) != set(s2): return False distance = sum([1 for i in range(len(s1)) if s1[i] != s2[i]]) if distance == len(s1): return True else: return distance
4eca36f0c020e9fa9d49ad925cc6fcff59a5d232
daniel-reich/ubiquitous-fiesta
/JcmSuBX2EaPfRkqZ8_3.py
159
3.71875
4
def get_total_price(groceries): total = 0 for item in groceries: total += item['price'] * item['quantity'] print(total) return round(total, 1)
22936a83d1fbef608284ad2006612fec2b41ef21
daniel-reich/ubiquitous-fiesta
/dcX6gmNguEi472uFE_24.py
285
3.984375
4
def double_factorial(num): if num==0 or num==1 or num==-1: return 1 if num%2==0: a=2 for i in range(2,num,2): a=a*(num+2-i) elif num%2!=0: a=1 for i in range(1,num,2): a=a*(num+1-i) return a
59ebaf0173e943552bb43c382cc508987d5ab1dc
daniel-reich/ubiquitous-fiesta
/QB6kPXQkFgMkzcc2h_15.py
200
3.78125
4
def remove_abc(txt): if 'a' in txt or 'b' in txt or 'c' in txt: txt = txt.replace('a', '') txt = txt.replace('b', '') txt = txt.replace('c', '') return txt else: return None
3dc6869dc458bf706ce757770ef9ffa08e82dba7
daniel-reich/ubiquitous-fiesta
/527uLRjSofaTsMu36_14.py
121
3.765625
4
def get_middle(word): l = len(word) return "" if l==0 else word[l//2] if l%2 == 1 else word[l//2 - 1] + word[l//2]
939d3cb2f713e372371b520ce2ab97b4492a3de4
daniel-reich/ubiquitous-fiesta
/t78eBofspi4nBCY4E_8.py
317
3.59375
4
def base_conv(n,b): if type(n) == int: ans = "" while n: ans = chr(n%b + 97) + ans n = n//b return ans else: if any(ord(l)-97 >= b or ord(l)-97 < 0 for l in n): return n + " is not a base " + str(b) + " number." return sum((ord(n[::-1][i])-97)*b**i for i in range(len(n)))
e98fba68776c31f49dd5db871cbe3bb448f1a932
daniel-reich/ubiquitous-fiesta
/frRRffQGSrPTknfxY_11.py
101
3.65625
4
def digit_count(num): num = str(num) return int(''.join([str(num.count(i)) for i in num]))
88dd05336ec56fd153f38c9c09959f7beab13ebc
daniel-reich/ubiquitous-fiesta
/peezjw73G8BBGfHdW_6.py
372
3.953125
4
def arithmetic_operation(n): numbers = str.split(n) if numbers[1]=='*': return int(numbers[0])*int(numbers[2]) if numbers[1]=='+': return int(numbers[0])+int(numbers[2]) if numbers[1]=='-': return int(numbers[0])-int(numbers[2]) if numbers[1]=='//': if int(numbers[2])==0: return -1 else: return int(numbers[0])/int(numbers[2])
2661c95e1a48fbaaa0d6200e0641db8118b5abe7
daniel-reich/ubiquitous-fiesta
/DJa7PoKDhTTmwnxJg_16.py
114
3.546875
4
def adjacent_product(lst): a = [] for x in range(len(lst)-1): a.append(lst[x]*lst[x+1]) return max(a)
6739b4c8edc000071a74e7cb81dcf82e62a734d1
daniel-reich/ubiquitous-fiesta
/bupEio82q8NMnovZx_16.py
422
3.84375
4
def track_robot(instructions): position = [0, 0] for item in instructions: item = item.split(" ") if item[0][0] == "r": position[0] += int(item[1]) elif item[0][0] == "l": position[0] -= int(item[1]) elif item[0][0] == "u": position[1] += int(item[1]) elif item[0][0] == "d": position[1] -= int(item[1]) return position
28ba15ae6c07cc6ded0ea2bb61830709376c4d51
daniel-reich/ubiquitous-fiesta
/RTZRnXCJkfALTTdqt_15.py
146
3.515625
4
def sum_neg(lst): a = len([x for x in lst if x > 0]) b = sum([x for x in lst if x < 0]) if a ==0 and b == 0: return [] return [a,b]
ff3b2533a3cae34e28a8ef20e9c1069b9870cd42
daniel-reich/ubiquitous-fiesta
/t56Nk2kJkQ6H4xzgX_8.py
155
3.546875
4
def swap_xy(txt): new = [t[1::] if t[0] == '(' else t[:-1] for t in txt.split(', ')] return "({}, {}), ({}, {})".format(new[1],new[0],new[3],new[2])
61218337d853a9683a6372d6b9e7ef50c2a45e9d
daniel-reich/ubiquitous-fiesta
/Fej5HSzcvHMdm2i4N_5.py
213
3.578125
4
def weight_allowed(car, p, max_weight): pounds = (max_weight / 0.453592) total = 0 for i in range(0,len(p)): total += p[i] total += car if total < pounds: return True else: return False
7cfd8dc24efa1fc274334a449dd8533e65ae6d3b
daniel-reich/ubiquitous-fiesta
/M47FDJLjfNoZ6k6gF_12.py
132
3.578125
4
from functools import reduce def cup_swapping(swaps): return reduce(lambda a, b: b.replace(a, "") if a in b else a, swaps, "B")
36a7c9560bfeafd767b7601a6ae98b374daed18b
daniel-reich/ubiquitous-fiesta
/82AvsFFQprj43XCDS_5.py
568
3.578125
4
import re ​ def no_strangers(txt): counter = {} friends = [] acquaintances = [] pattern = re.compile(r"[\w']+", re.IGNORECASE) words = re.findall(pattern, txt) ​ for word in words: word = word.lower() if word not in counter: counter[word] = 1 else: counter[word] += 1 if(counter[word]==3 and word not in acquaintances): acquaintances.append(word) if(counter[word]==5 and word not in friends): friends.append(word) acquaintances.remove(word) ​ return [acquaintances, friends]
4bd1265f1a1c139b32b1cf1dced439cfdb39981b
daniel-reich/ubiquitous-fiesta
/iHdZmimb82rAvEDkG_11.py
608
3.828125
4
def first_even(lst): for i in range(len(lst)): if parity(lst[i]) == 0: return [lst[i], i] return False ​ def parity(n): return n - ((n >> 1) << 1) ​ def bitwise_index(lst): has_even = first_even(lst) if has_even == False: return 'No even integer found!' else: cur_largest = has_even[0] large_ind = has_even[1] for i in range(len(lst)): if lst[i] > cur_largest and parity(lst[i]) == 0: cur_largest = lst[i] large_ind = i if parity(large_ind) == 0: s = '@even' else: s = '@odd' s = s + ' index ' + str(large_ind) return {s:cur_largest}
ff436cecc88741e58630835afa63590e79c53698
daniel-reich/ubiquitous-fiesta
/yuPWwSbCGPm2KzSzx_7.py
904
3.71875
4
prices = { "Strawberries" : "$1.50", "Banana" : "$0.50", "Mango" : "$2.50", "Blueberries" : "$1.00", "Raspberries" : "$1.00", "Apple" : "$1.75", "Pineapple" : "$3.50" } ​ class Smoothie: def __init__(self,ingri): self.ingredients = ingri def get_cost(self): cost = 0 for i in self.ingredients: cost+=float(prices[i][1:]) ​ return '$'+str(format(cost,'.2f')) def get_price(self): c = float(self.get_cost()[1:]) p = c+c*1.50 return '$'+str(format(round(p,2),'.2f')) def get_name(self): ig = self.ingredients for i in range(len(ig)): if ig[i][-3:] == "ies": ig[i] = ig[i][:-3] + "y" ig.sort() if len(ig)>1: ig.append("Fusion") else: ig.append("Smoothie") return " ".join(ig)
881bb6b50ee333a0033d79c014c6ec4444dfee5d
daniel-reich/ubiquitous-fiesta
/9Q5nsEy2E2apYHwX8_10.py
488
3.546875
4
class programer: def __init__ (self,sallary, work_hours): self.sallary = sallary self.work_hours = work_hours def __del__ (self): return "oof, "+str(self.sallary)+ ", "+ str(self.work_hours) def compare (self,other): if self.sallary > other.sallary: return other elif self.sallary < other.sallary: return self elif self.sallary == other.sallary: if self.work_hours > other.work_hours: return other else: return self
1ce71afe28098192b4b76394d19762b4a1de4818
daniel-reich/ubiquitous-fiesta
/mYGipMffRTYxYmv5i_5.py
401
3.59375
4
def simple_equation(a, b, c): myans = '' if a+b == c: myans = str(a)+'+'+str(b)+'='+str(c) return myans if a-b == c: myans = str(a)+'-'+str(b)+'='+str(c) return myans if a*b == c: myans = str(a)+'*'+str(b)+'='+str(c) return myans if a//b == c: myans = str(a)+'/'+str(b)+'='+str(c) return myans ​ return myans
b734865432991ad69db992d18aeec68c5d054547
daniel-reich/ubiquitous-fiesta
/ix39oLQv3Zfppfvkg_0.py
321
3.640625
4
def multiply_matrix(m1, m2): n=len(m1) m=len(m2[0]) M=[[0 for j in range(m)] for i in range(n)] m2_t=[list(x) for x in zip(*m2)] if len(m1[0])==len(m2): for i in range(n): for j in range(m): M[i][j]=sum(m1[i][k]*m2_t[j][k] for k in range(len(m1[0]))) return M else: return "ERROR"
7b6dfaeb8e7d9126bbb4df3e669d6756e44fbc9a
daniel-reich/ubiquitous-fiesta
/9cY7ymbp5mtrKdxyR_16.py
675
3.65625
4
def encryption(txt): txt = txt.replace(" ", "") x = len(txt) rows = round(x**0.5) for i in range(rows+3): if i*rows >= x: columns = i break table = [txt[i:i+columns] for i in range(0, x, columns)] output = "" for i in range(columns): for j in table: try: output += j[i] except: break if i != columns-1: output += " " return output ​ print(encryption("haveaniceday")) print(encryption("feedthedog")) print(encryption("chillout")) print(encryption("A Fool and His Money Are Soon Parted."))
e7a451a6e14c7ae2fc9722fef7397c96aad73eb5
daniel-reich/ubiquitous-fiesta
/vTGXrd5ntYRk3t6Ma_3.py
143
3.6875
4
def is_isogram(txt): txt = txt.lower() for letter in txt: if txt.count(letter) > 1: return False return True
a3fef3281041ad935916362cf48bc71af499adf8
daniel-reich/ubiquitous-fiesta
/FiPf9yTEfo5aBikPF_5.py
215
3.546875
4
def coins_combinations(money, coins, value=0): if value == money: return 1 return sum(coins_combinations(money, coins[i:], value + coins[i]) \ for i in range(len(coins))) if value < money else 0
9025fec4afe2361f0ab82b242e9f0ac045f46e57
daniel-reich/ubiquitous-fiesta
/b67PHXfgMwpD9rAeg_21.py
158
3.734375
4
def plus_sign(txt): return not (txt[0].isalpha() or txt[-1].isalpha()) and all(txt[i-1]+ txt[i+1]=="++" for i in range(len(txt)) if txt[i].isalpha())
610432430b88c4821457b46c7cd33f5470f72c60
daniel-reich/ubiquitous-fiesta
/5h5uAmaAWY3jSHA7k_13.py
770
3.84375
4
def landscape_type(lst): maxp = -1 minp = -1 for i in range(1,len(lst)-1): if lst[i-1] < lst[i] and lst[i] > lst[i+1]: print(lst[i-1],lst[i],lst[i+1]) if maxp == -1 and lst[i] != lst[0] and lst[i] != lst[-1]: maxp = i else: return 'neither' for i in range(1,len(lst)-1): if lst[i-1] > lst[i] and lst[i] < lst[i+1]: if minp == -1 and lst[i] != lst[0] and lst[i] != lst[-1]: minp = i else: return 'neither' if maxp != -1 and minp == -1: if maxp != 0 or maxp != len(lst): return 'mountain' else: return 'neither' elif minp != -1 and maxp == -1: if minp != 0 or minp != len(lst): return 'valley' else: return 'neither' else: return 'neither'
e8a723eb744894a0b9c25ceb896ffbcd119e053e
daniel-reich/ubiquitous-fiesta
/pDmDP9KhXmBTcScT6_6.py
230
3.75
4
def get_name(string): alphabet, name = 'abcdefghijklmnopqrstuvwxyz', [] for i in list(string): if i.lower() in alphabet: name.append(i) if i == "@": break return "".join(name)
21874fac3353b442fee035c4758532ec7caeb267
daniel-reich/ubiquitous-fiesta
/rPnq2ugsM7zsWr3Pf_24.py
245
3.8125
4
def find_all_digits(l): digits = set(list('0123456789')) i = 0 while len(digits) > 0 and i < len(l): digits -= set(str(l[i])) if len(digits) == 0: return l[i] i += 1 return 'Missing digits!'
b35f71410ed30e8b4b371e59c460e9f87f9f5f7b
daniel-reich/ubiquitous-fiesta
/TTdhB3jbKFxb3bDXv_18.py
200
3.75
4
def left_shift(lst, n): while n != 0: lst = lst[1:] + lst[0:1] n = n - 1 return lst ​ def right_shift(lst, n): while n != 0: lst = lst[-1:] + lst[:-1] n = n - 1 return lst
779ea6c55e24de7efe2ae621f4cd4ab7e9f758d2
daniel-reich/ubiquitous-fiesta
/PYEuCAdGJsRS9AABA_6.py
1,121
3.703125
4
class CoffeeShop: orders=[] def __init__(self, name, menu, orders): self.name=name self.menu=menu self.orders=orders def add_order(self, item): M=[x['item'] for x in self.menu] if item in M: self.orders.append(item) return "Order added!" else: return "This item is currently unavailable!" def fulfill_order(self): if self.orders: return "The {} is ready!".format(self.orders.pop(0)) else: return "All orders have been fulfilled!" def list_orders(self): return self.orders def due_amount(self): s=0 for x in self.orders: for y in self.menu: if y['item']==x: s+=y['price'] return round(s,2) def cheapest_item(self): A=[] for y in self.menu: A.append((y['item'],y['price'])) if A: return sorted(A, key=lambda x: x[1])[0][0] def drinks_only(self): B=[] for y in self.menu: if y['type']=="drink": B.append(y['item']) return B def food_only(self): B=[] for y in self.menu: if y['type']=="food": B.append(y['item']) return B
5c4cd045d038056485b3aed59098a176c22a42dd
daniel-reich/ubiquitous-fiesta
/Ggq8GtYPeHJQg4v7q_0.py
94
3.546875
4
def replace_vowels(txt, ch): return ''.join([i if i not in 'aeoui' else ch for i in txt])
74e0b47519345c7d055dbb79d362ff38435aec96
daniel-reich/ubiquitous-fiesta
/jT7PY2yTWTuxcqpJe_9.py
1,193
3.546875
4
def spiral_order(mat): def right(): nonlocal mat, i, j, num, res while j+1 < col and num >= 1 and mat[i][j+1] != '-': res.append(mat[i][j+1]) mat[i][j+1] = '-' j += 1 num -= 1 def down(): nonlocal mat, i, j, num, res while i+1 < row and num >= 1 and mat[i+1][j] != '-': res.append(mat[i+1][j]) mat[i+1][j] = '-' i += 1 num -= 1 def left(): nonlocal mat, i, j, num, res while j-1 >= 0 and num >= 1 and mat[i][j-1] != '-': res.append(mat[i][j-1]) mat[i][j-1] = '-' j -= 1 num -= 1 def up(): nonlocal mat, i, j, num, res while i-1 > 0 and num >= 1 and mat[i-1][j] != '-': res.append(mat[i-1][j]) mat[i-1][j] = '-' i -= 1 num -= 1 def seq(): nonlocal i, j, cnt while num >= 1: right() down() left() up() cnt += 1 ​ row = len(mat); col = len(mat[0]); num = row*col-1 i = 0; j = 0; cnt = 0; res = [mat[i][j]] seq() return res
44de2ebe7cdd1bce42b1281fa117367c07f1ea91
daniel-reich/ubiquitous-fiesta
/8xLnFm4HW4bzJrqjc_10.py
107
3.671875
4
def digit_distance(num1, num2): return sum(abs(int(x) - int(y)) for x, y in zip(str(num1), str(num2)))
bfc8479cad08f266b3411349b72c067fccecd584
daniel-reich/ubiquitous-fiesta
/4AtqpqKdXAFofa566_19.py
105
3.515625
4
def remove_leading_trailing(n): res = str(float(n)) return res[:-2] if res.endswith('.0') else res
fcfc8e31da174fc29148121e76c9d51375d3f8e4
daniel-reich/ubiquitous-fiesta
/fNQEi9Y2adsERgn98_13.py
223
3.609375
4
def perimeter(lst): from math import sqrt lst.append(lst[0]) a = 0 for i in range(len(lst)-1): a += sqrt((lst[i][0] - lst[i + 1][0]) ** 2 + (lst[i][1] - lst[i + 1][1]) ** 2) return round(a, 2)
6f256d42a039a1f1f97b83a7ccb1095891e2cd65
daniel-reich/ubiquitous-fiesta
/b4fsyhyiRptsBzhcm_6.py
100
3.75
4
def sum_even_nums_in_range(start, stop): return sum([x for x in range(start,stop+1) if x%2==0])
9f9f9238ba7fb1bf5ab2b7ae78a57e2a68d23593
daniel-reich/ubiquitous-fiesta
/a55ygB8Bwj9tx6Hym_15.py
172
3.6875
4
def steps_to_convert(txt): num = 0 num1 = 0 for i in txt: if(i.isupper()): num += 1 else: num1 += 1 return min([len(txt)-num, len(txt)-num1])
72f969488a62933954ee636459eb38c6ba2fac72
daniel-reich/ubiquitous-fiesta
/htMy9tkX4wFWHZtsY_23.py
639
3.78125
4
from itertools import dropwhile,takewhile def palindrome_time(lst): def string(h,m,s): s1 = str(m).rjust(2, '0') s2 = str(s).ljust(2,'0') return int(str(h) + s1 + s2) hours = list(filter(lambda x: x % 10 < 6, range(24))) minutes = list(range(0,56,11)) seconds = list(map(lambda x: int(str(x)[::-1]),hours)) count = 0 for hour,second in zip(hours,seconds): if hour >= lst[0] and hour <= lst[3]: for minute in minutes: if string(hour,minute,second) >= string(lst[0],lst[1],lst[2]): if string(hour,minute,second) <= string(lst[3],lst[4],lst[5]): count += 1 ​ return count