17.3k views
3 votes
The Wizarding World is establishing trade with the Muggle World, specifically the United States, and needs a currency exchange program. The Wizarding World currency consists of Galleons, Sickles, and Knuts. The exchange rate is 10 pennies for 1 Knut. Additionally, 1 Sickle is worth 29 Knuts, and 1 Galleon is worth 17 Sickles. Write a Python program that prompts users for the amounts of Knuts, Sickles, and Galleons they have and calculates the corresponding value in US dollars (expressed in pennies). Ensure that the program outputs the result clearly.

1 Answer

2 votes

Final answer:

To write a Python program that calculates the corresponding value in US dollars (expressed in pennies) for the Wizarding World currency, follow the given exchange rates and use the appropriate formulas.

Step-by-step explanation:

To write a Python program that calculates the corresponding value in US dollars (expressed in pennies) for the Wizarding World currency, you can follow the given exchange rates:

  • 1 Knut = 10 pennies
  • 1 Sickle = 29 Knuts
  • 1 Galleon = 17 Sickles

You will prompt the users for the amounts of Knuts, Sickles, and Galleons they have. Then, you can calculate the total amount in US dollars (pennies) by multiplying the respective exchange rate for each currency and summing them up. Finally, you can output the result clearly.

User Jontyc
by
8.8k points