-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}")
Shen
  • 19
  • 4
  • 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 – bsatprivat Apr 26 '23 at 08: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) – SiHa Apr 26 '23 at 08:11
  • Does this answer your question? [How to stop Python closing immediately when executed in Microsoft Windows](https://stackoverflow.com/questions/12375173/how-to-stop-python-closing-immediately-when-executed-in-microsoft-windows) – SiHa Apr 26 '23 at 08:11

1 Answers1

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.

Starshine
  • 11
  • 4