×
Reviews 4.9/5 Order Now

Currency Converter with Python Homework Solution

June 22, 2024
Dr. David Adam
Dr. David
🇦🇺 Australia
Python
Dr. David Adams, a distinguished Computer Science scholar, holds a PhD from the University of Melbourne, Australia. With over 5 years of experience in the field, he has completed over 300 Python assignments, showcasing his deep understanding and expertise in the subject matter.
Key Topics
  • Currency Change between USD, CAD, GBP and MXP
Tip of the day
Break your Python assignment into smaller tasks and test each part separately. Use meaningful variable names, write comments for clarity, and leverage built-in functions to simplify your code.
News
In 2025, JetBrains Fleet 2.0 introduced AI-powered code completion, while VS Code added advanced AI-driven bug detection and coding assistants, enhancing programming efficiency.

Currency Change between USD, CAD, GBP and MXP

The project is to make a currency converter with the help of Python. You have to make a basic currency converter with the help of Python, which will include USD, Canadian dollar, British pound, and Mexican Peso.

Solution:

amount = int(input("Enter amount:")) values = {'USD': 1.00, 'Pound': 1.40, 'CAD': 0.81, 'Peso': 0.05} while True: currencytype = input("Enter currency type, options: USD/CAD/Pound/Peso ") if currencytype in ['USD', 'CAD', 'Pound', 'Peso']: break else: print('Please enter correct currency type. options: USD/CAD/Pound/Peso ') while True: totype = input("Enter the currency type you want to convert to, option: USD/CAD/Pound/Peso ") if totype in ['USD', 'CAD', 'Pound', 'Peso']: break else: print('Please enter correct currency type. options: USD/CAD/Pound/Peso ') newamount = amount * values[currencytype]/values[totype] print('Convert to: {:.2f} {}'.format(newamount, totype))

Screenshot:

output screenshot

Similar Samples

Explore our curated collection of programming homework samples at ProgrammingHomeworkHelp.com. Our examples cover a wide range of languages and topics, demonstrating our proficiency in delivering clear, well-commented solutions. These samples serve as valuable learning resources, showcasing our commitment to academic excellence and helping students grasp complex programming concepts effectively.