163k views
2 votes
19.

(02.02 MC)
Read the following code used to calculate the total cost of cookies sold:

boxes = input("How many boxes of cookies did you sell?")
cost = 4
totalCost = boxes * cost

There is an error in the code. Which additional function needs to be used with the input() function? (3 points)

float()
add()
int()
str()

Will give 50 points

2 Answers

4 votes

Answer:

The int() function because you want the user to type an integer not a string

This is a short explanation

User Michael Krause
by
7.2k points
2 votes

Answer:

The int() function must be used with the input() function.

Step-by-step explanation:

The int() function converts the specified value into an integer. The reason it's the int() function and not any of the others because the number of boxes must be a whole number.

Hope this helps!! <3

User Uchar
by
7.4k points