Program 2: DiscretionarySpending.py Discretionary spending is the amount of money left over after bills such as rent, utilities, and groceries have been paid. Use the pseudocode below to write the Python code for the program DiscretionarySpending. As an optional challenge, can you figure out how to display pay, totalBills, and discretionary formatted to display as currency? Example: $158.23 instead of 158.23456. What can you find on the internet to help you accomplish this task?
Discretionary spending is the amount of money left over after bills such as rent, utilities, and groceries have been paid.
Use the pseudocode below to write the Python code for the program DiscretionarySpending. As an optional challenge,
can you figure out how to display pay, totalBills, and discretionary formatted to display as currency?
Example: $158.23 instead of 158.23456. What can you find on the internet to help you accomplish this task?
As per the given problem, we need to write a Python program that calculates Discretionary spending.
As given the program,
Discretionary spending = Total pay - Total bills (Ex rent, utilities and groceries)
Also we need to format the amount upto 2 decimal places.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images