×
Samples Blogs Make Payment About Us 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
Use Python libraries effectively by importing only what you need. For example, if you're working with data, using libraries like pandas and numpy can save time and simplify complex tasks like data manipulation and analysis.
News
In 2024, the Biden-Harris Administration has expanded high-dosage tutoring and extended learning programs to boost academic achievement, helping programming students and others recover from pandemic-related setbacks. These initiatives are funded by federal resources aimed at improving math and literacy skills​

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.