Skip to content

Instantly share code, notes, and snippets.

@chipolux
Created January 28, 2019 03:52
Show Gist options
  • Save chipolux/f00bc5f37bbf18ad966d5171b40d98fb to your computer and use it in GitHub Desktop.
Save chipolux/f00bc5f37bbf18ad966d5171b40d98fb to your computer and use it in GitHub Desktop.
Simple Currency Conversion
def main():
conversions = [
# In Hyrule Lon Lon Milk si 10 rupees and a gallon of milk is 2.53 dollars.
{"country": "Hyrule", "rate": 3.9525, "name": "rupees"},
# In Animal Crossing a kettle is 960 bells and 19.48 dollars.
{"country": "Animal Crossing", "rate": 49.2813, "name": "bells"},
# In Skyrim a bottle of milk is 6 septims, a pint of milk is 1.29 dollars.
{"country": "Skyrim", "rate": 4.6511, "name": "septims"},
]
usd = float(input('Please enter amount in US Dollars: '))
print('$%.2f is' % usd)
for conversion in conversions:
print(' %.2f %s in %s' % (
conversion['rate'] * usd,
conversion['name'],
conversion['country'],
))
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment