Answers for "python - exchange rate API"

0

python - exchange rate API

import requests

APP_ID = "**********************"
ENDPOINT = "https://openxchangerates.org/latest.json"
response = requests.get(f"{ENDPOINT}?app_id={APP:ID}")
exchange_rate = response.json()["rates"]
usd_amount = 1000
gbp_amount = usd_amount * exchange_rate["GBP"]
print(f"USD{usd_amount} is GBP{gbp_amount}")
Posted by: Guest on September-15-2020

Python Answers by Framework

Browse Popular Code Answers by Language