r/madeinpython • • May 08 '21

Make a real-time currency converter in python with just 8 lines of code!

https://twitter.com/MatveyNikonorov/status/1391071696086568962
7 Upvotes

6 comments sorted by

12

u/SweetOnionTea May 08 '21

For anyone too lazy to read the article from the tweet the 8 lines are here:

from forex_python.converter import CurrencyRates
c = CurrencyRates()
amount = int(input("Enter the amount: "))
from_currency = input("From Currency: ").upper()
to_currency = input("To Currency: ").upper()
print(from_currency, " To ", to_currency, amount)
result = c.convert(from_currency, to_currency, amount)
print(result)

I understand we all should try to use tools at hand, but is this really making a currency converter at this point?

9

u/Zymoox May 08 '21

Agreed. After just reading the title, I instantly knew this was just going to be an import.

2

u/SweetOnionTea May 09 '21

It makes me kind of wonder why you would spend so much time making a blog, posting links to Twitter, and then posting the Twitter links to Reddit? I'm sure more time was spent doing that. Everything OP has submitted is virtually just Twitter links to their blog like this.

3

u/PinBot1138 May 09 '21

8 lines is impressive, but this is a great 1 line program:

import antigravity

5

u/awesomeprogramer May 08 '21

LOC doesn't mean anything generally, especially not when you import a damn library that does everything...

3

u/twitterInfo_bot May 08 '21

๐Ÿ’ต๐Ÿ’ดMake a real-time currency converter in #python with just ๐Ÿ  lines of code!๐Ÿ’ถ๐Ÿ’ท #pythonlearning #pythonprogramming #CodeNewbie #coding #100DaysOfCode ๐Ÿ‘‡


posted by @MatveyNikonorov

Link in Tweet

(Github) | (What'sโ€…new)