Menu
Coddy logo textTech

To USD

Lesson 2 of 5 in Coddy's Currency Converter - Python Project course.

The base of our Converter will be USD (United States Dollar).

In your code you can see the hardcoded currencies values we will work with in a python dictionary,

CURRENCIES = {
    'USD': 1,
    'EUR': 1.06,
    'YEN': 0.0067,
    'GBP': 1.23,
    'AUD': 0.64,
    'CAD': 0.74
}

All the values are calculated relative to USD.

For example, 1 CAD (Canadian Dollar) is 0.74 USD.

Do not delete/change this hardcoded dictionary throughout this course! 

challenge icon

Challenge

Easy

Let's start by creating the first helper function - to_usd.

The function will get currency code and amount and will return its equivalent value in USD.

Try it yourself

CURRENCIES = {
    'USD': 1,
    'EUR': 1.06,
    'YEN': 0.0067,
    'GBP': 1.23,
    'AUD': 0.64,
    'CAD': 0.74
}

# Write code here

All lessons in Currency Converter - Python Project