×
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
Start with basic image processing concepts like color spaces and transformations. Practice simple OpenCV examples to build confidence before tackling complex tasks.
News
In 2024, the release of the 'AsyncIO Toolkit' has made asynchronous programming in Python more efficient. Similarly, 'React Quantum' introduces quantum computing concepts to JavaScript, expanding learning opportunities for students.

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.