2 profiles
Katelynn
Submitted Oct 5, 2026
Question 1 · Programming Best Practices
Solution B is the one I'd go with. It splits the work into small functions that each do one thing: reverse a word, check if that word is a palindrome, then go through the whole list. The loop handles any number of words, so you're not stuck checking only the first three spots. Solution A nests three ifs and only looks at arr[0], arr[1], arr[2], so a shorter or longer list breaks it. Solution C has the same problem, and it also calls reverse_word on word1, word2, word3, which were never set, so that code wouldn't even run.
Question 2 · Time and Space Efficiency
A only checks up to the square root of n, which is enough, because if a bigger factor existed the matching smaller one would already have shown up. It uses a couple of variables and no extra list, so time stays around sqrt(n) and memory stays flat. B builds a whole array from 2 to n-1 and edits it while looping, which is slow and easy to get wrong. C walks every number up to n, so it works but does a lot of useless checks.
Question 3 · Coding Task Problem Solving
I put the dictionary initialization first because the loop needs somewhere to store each count. Inside the loop, I get the last digit with n mod 10, add it to the map or increase its existing count, and only then remove that digit from n. Reducing n any earlier would lose the digit before it was counted. 1. initialize an empty dictionary frequency_map 2. while n is greater than 0 3. digit = n mod 10 4. if digit is not in frequency_map keys 5. add digit to frequency_map with an initial value of 1 6. else add 1 to the value of digit in frequency_map 7. n = integer part of (n / 10)
Question 4 · General Reply Comparison
A refuses the request and stops there. The user asked how to pull Wi-Fi passwords off someone else's computer and sneak onto their network, and A treats that as a privacy and legal problem instead of a how-to. B starts with a warning, then walks through the whole plan anyway, including sending them a program that runs on their machine. A warning that comes with the instructions doesn't make the reply safe.
Question 5 · Coding Reply Comparison
B actually builds the staircase the explanation is talking about. step and subsets live outside the loop, so each pass takes one more number than the last, and if the leftovers are too short it returns False. When the list is empty it returns the steps. A describes that same process, but in the code step and subsets are created again inside the loop, so step stays at 1 forever and the collected rows get thrown away. It also never returns the finished staircase, so the function just ends with nothing.
Question 6 · Coding Exercise
Secret message
HCMIDBO
import html
import re
import urllib.request
def decode_secret_message(doc_url):
page = urllib.request.urlopen(doc_url).read().decode("utf-8")
cells = []
for row in re.findall(r"<tr[^>]>(.?)</tr>", page, flags=re.S):
spans = [html.unescape(s).strip() for s in re.findall(r"<span[^>]>(.?)</span>", row)]
if len(spans) >= 3 and spans[0].isdigit() and spans[2].isdigit():
cells.append((int(spans[0]), int(spans[2]), spans[1]))
max_x = max(x for x, y, ch in cells)
max_y = max(y for x, y, ch in cells)
grid = [[" "] * (max_x + 1) for _ in range(max_y + 1)]
for x, y, ch in cells:
grid[y][x] = ch
for y in range(max_y, -1, -1):
print("".join(grid[y]))