08:33:26 From Niko Rush : return [num for num in nums if num <= limit] 08:34:27 From Mireya De Los Reyes : sum = 0 for i in nums: if i <= limit: sum += i return(sum) 08:37:08 From Timothy Deng : return ''.join(sorted(list(word),reverse=True)) 08:37:11 From Alec Nipp : return "".join(sorted(word, reverse = True)) 08:37:19 From Sourodeep Bhattacharya : l = list(word) l.sort() newl = l.copy() n = 1 for x in range(len(l)): l[x] = newl[len(newl) - n] n += 1 s = "" return s.join(l) 08:37:28 From Rujula Yete : word=list(word) sorted=word.sort() reversed=word[::-1] return "".join(reversed) 08:38:04 From Kira Montambo : alphabet = 'zyxwvutsrqponmlkjihgfedcba' new = '' for char in alphabet: if char in word: for x in range (0, word.count(char)): new += char return new 08:41:30 From Melissa Du : return "".join(sorted(word, reverse=True)) 08:44:34 From Niko Rush : return set(word1) == set(word2) 08:44:35 From Alec Nipp : return True if set(word1) == set(word2) else False 08:45:51 From Alec Nipp : Return set(word1) == set(word2) 08:48:03 From Mireya De Los Reyes : word1 = list(word1) word2 = list(word2) word1.sort() word2.sort() w1 = [] for i in word1: if i not in w1: w1.append(i) w2 = [] for i in word2: if i not in w2: w2.append(i) if w1 == w2: return True else: return False 08:48:23 From Kira Montambo : for x in range(0, len(word1)): if word1[x] not in word2: return False for x in range(0, len(word2)): if word2[x] not in word1: return False return True 08:49:39 From Jonathan Jacob : def is_in(word1, word2): out = True for i in word1: if i not in word2 : out = False return out def have_same_letters(word1, word2): """word1 and word2 are strings. returns True if word1 and word2 contain exactly the same letters. example have_same_letter("called", "laced") -> True """ return is_in(word1, word2) and is_in(word2, word1)) 08:50:14 From James Li : def have_same_letters(word1, word2): return bool(re.search(f"[{word1}]+",word2)) and bool(re.search(f"[{word2}]+",word1)) 08:53:15 From Sourodeep Bhattacharya : tab1 = "
    \n\t" li = "" for x in range(len(items)-1): li += f"
  1. {items[x]}
  2. \n\t" li += f"
  3. {items[len(items)-1]}
  4. \n" tab2 = "
" return tab1 + li + tab2 08:53:36 From Timothy Deng : string = "
    \n" for item in items: string += "
  1. " + item + "
  2. \n" string += "
" return string 08:53:42 From Jonathan Jacob : out = "
    \n" for i in items: out += "
  1. %s
  2. \n" % (i) out += "
" return out 08:53:46 From Rujula Yete : html="" for x in items: html+= "\t
  • "+x+"
  • \n" return "
      \n"+html+"
    " 08:53:50 From James Li : out = "
      \n" for item in items: out += f"
    1. {item}
    2. \n" out += "
    \n" return out 08:54:03 From Niko Rush : return "
      \n" + " ".join(["
    1. " + item + "
    2. \n" for item in items]) + "
    " 08:56:38 From Kira Montambo : x = """
    1. """ y = """
    2. """ z = """
    """ for i in items: if items[-1] == i: x = x + i else: x = x + i + y return x + z 08:56:57 From Melissa Du : HTML = "
      \n" for string in items: HTML += "
    1. "+string+"
    2. \n" HTML += "
    " return HTML 09:02:02 From Timothy Deng : def find_all_sublists(nums): sublists = [] for i in range(2 ** len(nums)): newList = [] i = list(bin(i)[2:]) while len(i) < len(nums): i.insert(0,'0') for j in range(len(nums)): if i[j] == '1': newList.append(nums[j]) sublists.append(newList) return sublists def sumFrom(nums, goal): """nums is a numerical list goal is a number returns a sublist of nums whose sum is goal if it exists and None otherwise. NB: this question can be done with a recursive solution in a few lines""" workingSublists = [] for sublist in find_all_sublists(nums): if sum(sublist) == goal: workingSublists.append(sublist) if len(workingSublists) > 0: return workingSublists else: return None 09:02:06 From Niko Rush : def sumFrom(nums, goal): """nums is a numerical list goal is a number returns a sublist of nums whose sum is goal if it exists and None otherwise. NB: this question can be done with a recursive solution in a few lines""" subsets = 2**len(nums) solution = None for i in range(1, subsets): bin(i)[2:] if (sum( [nums[j] for j in range(0, len(nums)) if (int)(bin(i)[2:].zfill(len(nums))[len(nums)-j-1]) ]) == goal): return [nums[j] for j in range(0, len(nums)) if (int)(bin(i)[2:].zfill(len(nums))[len(nums)-j-1]) ] 09:02:15 From Niko Rush : My solution was very hacky 09:03:12 From James Li : out = [] for index in range(len(nums)): for sublist_last_index in range(index, len(nums)): sublist = nums[index:sublist_last_index] if (sum(sublist) == goal): out.append(sublist) return out if len(out) > 0 else None 09:03:44 From Rujula Yete : length=range(len(nums)) for x in length: for i in length: if sum(nums[x:i+1])==goal: return nums[x:i+1] 09:10:34 From Timothy Deng : yep 09:11:02 From Timothy Deng : the second if should be nested 09:11:08 From Timothy Deng : wait no 09:11:13 From Timothy Deng : the second if should be out of the for loop 09:15:54 From Anya Schrader : def sumFrom(nums, goal): """nums is a numerical list goal is a number returns a sublist of nums whose sum is goal if it exists and None otherwise. NB: this question can be done with a recursive solution in a few lines""" sum=0 #Initializes sum additives=[] #Initializes additives for i in range(0,len(nums)): #Checks all numbers in list if sumgoal: #If the goal has been surpassed sum-=nums[i-1] #Take away the last number additives.remove(nums[i]) #Delete it from the list return additives #Return the list of numbers 09:16:02 From Anya Schrader : I think mine is a little too long 09:16:21 From Niko Rush : Yeah, I think I left it there on accident I think 09:16:49 From Niko Rush : I don't think it gives any error but it's useless. I probably used it while debugging.