Difference between revisions of "PromptCode/4"

From srakrn | Wiki
Jump to navigation Jump to search
Line 1: Line 1:
'''PromptCode challenge:'''
+
{{PromptCode Instruction}}
 
 
* 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
 
  
 
<pre>
 
<pre>
Line 18: Line 9:
 
     return inv_fib(i - 2, x_0, x_1) - inv_fib(i - 1, x_0, x_1)
 
     return inv_fib(i - 2, x_0, x_1) - inv_fib(i - 1, x_0, x_1)
 
</pre>
 
</pre>
 +
 +
Hint 1: {{censored | The full function name is inverse_fibonacci}}

Revision as of 15:59, 21 April 2026

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, LLM keeps continuing with the context from its earlier message.
    • Hard mode: reset to new conversation or 'edit' the message sent to LLM for every prompt.
  • Highlight the black censored text for hint.



def inv_fib(i, x_0, x_1):
    if i == 0:
        return x_0
    if i == 1:
        return x_1
    return inv_fib(i - 2, x_0, x_1) - inv_fib(i - 1, x_0, x_1)

Hint 1: The full function name is inverse_fibonacci