135k views
5 votes
Consider this program: Cost1 = input("Please enter the first expense: ") Cost2 = input("Please enter the second expense: ") print("Your total for both expenses was", Cost1 + Cost2) If the user inputs “10” for the first expense and “20” for the second expense, what will the interpreter show in the final line when this program is run? If this result in not what the programmer intended, how would you explain what went wrong?

User Kobame
by
6.0k points

2 Answers

5 votes

Answer:

The inputs will not be treated as integers or floats unless specified to do so. They will be strings by default and treated as text characters - so the output is 1020.

Step-by-step explanation:

My teacher even said this to me so this is the answer.

User Mithrop
by
6.1k points
4 votes

it will show '1020'

the inputs dont know that youre putting in numbers. When it adds the inputs together, it just shows them side by side.

User Mkkhedawat
by
5.5k points