194k views
2 votes
What is the value of the variable moneyDue after these lines of code are executed?

>>> numSodas = 2
>>> costSodas = 1.50
>>> moneyDue = numSodas * costSodas

2 Answers

1 vote

Answer:

3.0

Step-by-step explanation:

edge

User Patrickn
by
4.0k points
4 votes

Answer:

3.0

Step-by-step explanation:

To understand why there is a blank decimal, we have to understand that when you add multiply or subtract with a float (in python), the result will also be a decimal, even you use a blank decimal in the equation. A circumstance where the output would just plain 3, you would have to put in the following:

>>>int(moneyDue)

To insure it will output an int. However, it does not use that line of code, thus proving the answer is 3.0.

hope this helped :D

User Rhubarb
by
4.2k points