Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This Choosing data types for input, storage and output worksheet is part of the VCE Software Development - U4O1 - development and evaluation journey. Print it as a booklet?
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: ")) | Ainput() returns a str, so age was never converted to an int. Adding 1 to a str causes a TypeError. | |
| 2print(f"Total: ${total:.2f}") | Bprice = float(input("Price: ")) | |
| 3Input always arrives as a str, even when the user types digits, so it must be converted before storing as a float | CAn int cannot be joined to a str with +. The stored number was not converted to text for output. | |
| 4A number stored as an int must be turned back into text with str() before joining it to other text for output | DFormats a stored float as text with 2 decimal places for output | |
| 5age = input("Age: ") next_age = age + 1 | EReads the typed text from the user and converts it to an int so it can be stored as a number | |
| 6score = 42 print("Score: " + score) | Fprint("Score: " + str(score)) |
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() always returns a str, so convert it (e.g. with int) to store it as a number. Turn it back into text with str() or an f-string when you output it.age = int(input("Enter your age: "))price = float(input("Enter the price: "))total = 12
print("Total: " + str(total))score = 87
print(f"Score: {score}%")name = input("Name: ")
print(type(name) == str)