[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Calculations and Variables

On 01/11/2019 17:07, MRAB wrote:
> On 2019-11-01 12:36, Rhodri James wrote:
>> On 31/10/2019 20:14, MRAB wrote:
>>> On 2019-10-31 18:46, ferzan saglam wrote:
>>>> The code below which I have written should print the result of 43.6 
>>>> with the given values I have included at the end of this question, 
>>>> but for some odd reason I get the result of 44.44.
>>>> bill = (input("Enter the total cost of the meal: \n"))
>>>> tip = (input("Enter how much the tip is: \n"))
>>>> split = (input("Enter how many people there are: \n"))
>>> Why are there parentheses around the inputs? Have you omitted the 
>>> conversion to numbers?
>> My guess is the OP is using Python2 rather than Python3.? So my first
>> piece of advice would be to switch to Python3 now so you don't have to
>> re-learn oddities like input(), print() and string handling.
> The OP says it prints 44.44.
> In Python 2, / does integer division, so it would print 44.00.

Well, it's inconsistent one way or the other.  We'll have to wait for 
more information.

Rhodri James *-* Kynesim Ltd