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 | |
|---|---|---|
| 1'{} and {}'.format('a') | AError: Not enough arguments for {} | |
| 2'{name}'.format('Alice') | BOutput: 1 + 2 = 3 | |
| 3'{} is {}'.format('Bob', 15) | COutput: Ali | |
| 4'{:.2f}'.format(3.14159) | DError: Named placeholder needs keyword arg | |
| 5print('{} + {} = {}'.format(1,2,3)) | EOk: Returns '3.14' | |
| 6print('{name}'.format(name='Ali')) | FValid: Bob is 15 |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
{} — Placeholder in .format() that is replaced by the argument value.~~.format()name = 'Alice'
print('Hello {}'.format(name))age = 15
print('Age: {}'.format( age))name = 'Bob'
print(f'{name} is here')price = 9.99
print('{:.2f}'.format(price))a = 5
b = 3
print(f'{a} + {b} = {a + b}')