51.9k views
5 votes
Write a Python program that prompts the user for his/her amount of money, then reports how many Nintendo Wiis the person can afford, and how much more money he/she will need to afford an additional Wii.

1 Answer

2 votes

Final answer:

To write a Python program that prompts the user for their amount of money and calculates how many Nintendo Wiis they can afford, follow the steps below...

Step-by-step explanation:

The steps of the python program are:

  1. Prompt the user to enter their amount of money as a floating-point number.
  2. Calculate the number of Nintendo Wiis the person can afford by dividing their amount of money by the price of a Wii.
  3. Calculate the additional amount of money needed to afford an additional Wii by subtracting the total cost of the Wiis the person can afford from their amount of money.
  4. Print the number of Nintendo Wiis the person can afford and the additional amount of money needed.

Here's an example program:

price_of_wii = 299.99

amount_of_money = float(input('Enter your amount of money: '))

number_of_wiis = int(amount_of_money // price_of_wii)
additional_money_needed = price_of_wii - (amount_of_money % price_of_wii)

print('You can afford', number_of_wiis, 'Nintendo Wiis')
print('You need', additional_money_needed, 'more money to afford an additional Wii')
User Stephen Woods
by
9.1k points