Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. from forex_python.converter import CurrencyRates
  2. c = CurrencyRates()
  3.  
  4. cur = ['IDR', 'BGN', 'ILS', 'GBP', 'DKK', 'CAD', 'JPY', 'HUF', 'RON', 'MYR', 'SEK',
  5. 'SGD', 'HKD', 'AUD', 'CHF', 'KRW', 'CNY', 'TRY', 'HRK', 'NZD', 'THB', 'EUR', 'NOK',
  6. 'RUB', 'INR', 'MXN', 'CZK', 'BRL', 'PLN', 'PHP', 'ZAR']
  7.  
  8. all_cur = set(cur)
  9.  
  10. print("Какую валюту вы хотите перевести: ")
  11. while True:
  12. val_from = input()
  13. if val_from not in all_cur:
  14. print("Введите заново")
  15. else:
  16. break
  17.  
  18. print("В какую валюту: ")
  19. while True:
  20. val_to = input()
  21. if val_to not in all_cur:
  22. print("Введите заново")
  23. else:
  24. break
  25.  
  26.  
  27. print("Сколько баблишка: ")
  28. n = int(input())
  29.  
  30. print("Введите дату или напишите -:")
  31. date = input()
  32.  
  33. if date == '-':
  34. a = c.convert(val_from, val_to, n)
  35. else:
  36. a = c.convert(val_from, val_to, n, date)
  37.  
  38. print(a)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement