PromptCode/3a

From srakrn | Wiki
Revision as of 15:45, 21 April 2026 by Srakrn (talk | contribs)
Jump to navigation Jump to search

PromptCode challenge:

  • Given the following code, use an LLM to generate a snippet of code that will function the same.
  • You can't cheat, which are basically:
    • Feed this code to an LLM and ask it to output the exact same thing.
    • Write this code in other languages and ask an LLM to rewrite in Python.
    • Prompt LLM the logic of this code line-by-line.
  • You can prompt as many time as you want.
    • Easy mode: conversation style
    • Hard mode: reset to new conversation or 'edit' the message sent to LLM for every prompt
def f(pairs):
    result = {}
    for key, value in pairs:
        if key not in result:
            result[key] = value
    return result

Hint 1: The full function name is tuples_to_dict

Hint 2: Go to PromptCode/3a for an expanded code