Python code only! (Do not include breaks or continue functions)
Write a program that asks the user to enter the amount that they budgeted for the month. A loop should then prompt the user to enter their expenses, one at a time and to enter 0 to quit. When the loop finishes, the program should display the the amount of budget left. (a negative number indicates the user is over budget and a positive number indicates the user is under budget) The program should prompt the user to run the program again. The user will enter details in the following order:
Notes:
/*If you any query do comment in the comment section else like the solution*/
budget = float(input("Total amount budgeted: "))
while True:
expense = float(input("Expense amounts(0 to quit): "))
if expense == 0:
break
else:
budget -= expense
choice = input("Run again? (Y/N): ")
if choice == 'Y' or choice == 'y':
continue
else:
break
if budget > 0:
print("Under Budget")
else:
print("Over Budget")
Get Answers For Free
Most questions answered within 1 hours.