×
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 Java assignment into smaller tasks, focus on understanding core concepts like OOP, and write clean, modular code. Use comments for clarity, and test each function thoroughly.
News
In 2025, the programming landscape is evolving with the emergence of new languages like Rhythm, designed for concurrent processing, and Quanta, tailored for quantum computing applications.

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.