1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Calculation Python

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

  1. Stack

    Stack Membro Participativo

    I'm an absolute beginner in Python, doing the following training task:

    "Two friends are eating dinner at a restaurant, the bill comes in the amount of 47.28 dollars. The friends split the bill evenly between them, after adding 15% tip for the service. Calculate the tip, the total amount to pay, and each friend's share, then output a message saying "Each person needs to pay: " followed by the resulting number".

    I wrote the code given below but the system is saying there is a calculation error there. What exactly can be the error?

    bill = 47.28
    tip = 15 // bill * 100
    total = bill + tip
    share = total // 2
    print("Each person needs to pay:" + str(share))

    Continue reading...

Compartilhe esta Página