Learn Before
Refining a Prompt for Python Code Generation
Analyze the developer's initial instruction below. Identify two specific weaknesses in the instruction that likely led to the described issues with the generated code, and explain how you would improve the instruction to address these weaknesses.
0
1
Tags
Ch.3 Prompting - Foundations of Large Language Models
Foundations of Large Language Models
Foundations of Large Language Models Course
Computing Sciences
Ch.2 Generative Models - Foundations of Large Language Models
Analysis in Bloom's Taxonomy
Cognitive Psychology
Psychology
Social Science
Empirical Science
Science
Related
A developer needs a Python function to calculate the average of a list of numbers. A crucial requirement is that the function must return 0 if the input list is empty, instead of raising an error. The developer provides the following natural language instruction to a code-generating tool: 'Write a Python function to calculate the average of a list of numbers.' Which of the following statements best evaluates this instruction's quality for the intended purpose?
Refining a Prompt for Python Code Generation
Crafting a Python Code Generation Prompt
Example of a Prompt and Completion for a Python Average Function