[Python] Number should be rounding to two decimal places but its not [duplicate]

Discussão em 'Python' iniciado por Stack, Junho 20, 2025.

  1. Stack

    Stack Membro Participativo

    print("Welcome to the tip calculator!")
    bill = float(input(f"What was the total bill? £"))
    tip = int(input("How much tip would you like to give? 10, 12 or 15? "))
    people = int(input( "How many people to split the bill? "))
    tip_as_percent = tip / 100
    total_tip_amount = bill * tip_as_percent
    total_bill = bill + total_tip_amount
    bill_per_person = total_bill / people
    final_amount = round(bill_per_person, 2)
    print(f"Each person should pay {final_amount}")


    The number should have multiple digits and should be rounding to two decimal places but its not. Does anyone know why?

    Continue reading...

Compartilhe esta Página