Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1Write a Python 3.12 function that returns the average of a list of numbers. | AThe prompt is vague: it has no language, no clear task, no inputs or outputs, and no constraints. | |
| 2Example: average([2, 4, 6]) should return 4.0 | BWrite a Python function called get_total that adds up a list of prices. | |
| 3A prompt should state constraints, such as which features to use or avoid and how to handle bad input. | CAn example input and expected output added to a prompt so the AI knows exactly what the code must do. | |
| 4A prompt should name the language so the AI generates code in the right language. | DDo not use any libraries. If the list is empty, return 0. | |
| 5Write some code that does stuff with numbers. | EA prompt that names the language and version, states one task, and describes the input (a list) and the output (an average). | |
| 6Write a Python program that reads a file, sorts the lines, validates the data, and draws a graph. | FIt asks for several tasks in one prompt instead of one task per prompt. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
code prompt — A clear AI request stating the language, the task, the inputs and outputs, and the constraints. Keep to one task per prompt, e.g. Write a Python function that returns an average.Write a Python function
that returns the average of a list.Write a Python function that
returns the average of a list of numbers.Example input: [2, 4, 6]
Example output: 4.0Write a Python function to average a list.
Constraint: return 0 if the list is empty.Python 3: write one function that finds
the largest number in a list.