159k views
4 votes
Read the following code used to calculate the difference in points between basketball Team A and Team B:

scoreA = float(input("What was team A's score?"))
scoreB = float(input("What was team B's score?"))
pointsDifference = scoreA - scoreB

There is an error in the code. Which function should be used, and why?
float(); points require decimals
int(); points are entered as whole numbers
print(); points are printed on scoreboards
str(); points are fixed, so no calculation is necessary

2 Answers

4 votes

Answer:

int(); points are entered as whole numbers

Step-by-step explanation:

The score in basketball are recorded in whole numbers, no decimals required.

User Evan Hobbs
by
4.1k points
3 votes

Answer:

int(); points are entered as whole numbers

I took the test, it was right my guy

User William Hou
by
5.0k points