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 | |
|---|---|---|
| 1age = int(input("Age: ")) | AAsks the user to type their age, then turns the typed text into a whole number | |
| 2price = float("4.50") | Btotal = int(input()) + 5 | |
| 3Use str() to turn a number into text so it can be joined to other text with + | CTurns the text "4.50" into a decimal number | |
| 4Convert typed text to a whole number before adding to it | Dprint("Score: " + str(score)) | |
| 5age = input("Age: ") print(age + 1) | EYou cannot join a number to text with +. Change the number to text using str(13). | |
| 6print("You are " + 13 + " years old") | Finput() gives text, not a number. Adding 1 to text causes an error. Wrap input() in int() first. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
int(input()) — input() gives text, so int() wraps it to turn the typed text into a whole number you can calculate with. Use float() for decimals. str() turns a number back into text.age = int(input("Age: "))
print(age + 1)price = float(input("Price: "))
print(price * 2)age = 12
print("You are " + str(age) + " years old")total = int(input("Number: ")) * 2
print(total)num = int(input("Number: "))
print(num * 2)