python - Getting a "can't multiply sequence by non-int of type 'float'" error -


this question has answer here:

currencies = {'yen': 0.0067, 'bsp': 1.35, 'usd': 0.65, 'ero': 0.85}  if choice == "2":     current_currency = input("what currency want exchange: japenese yen if please type yen // british sterling pound please type bsp // dollers please type usd // euro please type ero.")     amount = input("type amount wish exchange")     future_currency = input("what currency want exchange into: japenese yen if please type yen // british sterling pound please type bsp // dollers please type usd // euro please type ero.")     new_amount = currencies[future_currency] / currencies[current_currency] * amount 

how fix this?

amount string, since input() returns strings. convert number first, running through numeric type's constructor.

amount = float(amount) 

Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -