-3

i am using pyinstaller to create exe file for my python program. When i test run the exe file, it supposed to print out the result after the calculation in the terminal, but the program just quit and disappear before printing the result, below is the codes:

print("Welcome to the Shen Ho's Lunch Expenses Calculator! :)")
bill = float(input("What was the total bill? RM "))
tax = int(input("How much percent of service tax in the bill? "))
people = int(input("How many people to split the bill? "))

total_tax_amount = (bill * tax) / 100
total_bill = bill + total_tax_amount
bill_per_person = total_bill / people
final_amount = round(bill_per_person, 2)

#the program quit completely before printing the final amount as stated in below:
print(f"Each person should pay: RM{final_amount}")
3
  • 1
    are you certain, the program does not print the line rather it closes right after it has printed it only you're not able to see it? Try you use another input to prevent the program from closing to ensure isn't that Commented Apr 26, 2023 at 8:05
  • 1
    I'd say that the program is doing exactly what you've told it to do, and then exiting (as it should when it reaches the end) Commented Apr 26, 2023 at 8:11
  • Does this answer your question? How to stop Python closing immediately when executed in Microsoft Windows Commented Apr 26, 2023 at 8:11

1 Answer 1

1

It is working for me:

Welcome to the Shen Ho's Lunch Expenses Calculator! :)
What was the total bill? RM 20
How much percent of service tax in the bill? 10
How many people to split the bill? 1
Each person should pay: RM22.0

if you are running app from console, you need to add an input to the end of your source to delay closing of command window until you press enter.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.