daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Feb 22nd, 2018 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Create currency converter
  2.  
  3. ## What to do?
  4.  
  5. - CLI application
  6. - web API application
  7.  
  8. ## What do we expect?
  9.  
  10. - show us your best
  11. - take your time, you have 2 weeks for implementation
  12. - real-life production ready project
  13.  
  14. ## Limitations
  15.  
  16. - Python
  17. - all modules are allowed
  18. - no other limitations
  19.  
  20. ## Parameters
  21. - `amount` - amount which we want to convert - float
  22. - `input_currency` - input currency - 3 letters name or currency symbol
  23. - `output_currency` - requested/output currency - 3 letters name or currency symbol
  24.  
  25. ## Functionality
  26. - if output_currency param is missing, convert to all known currencies
  27.  
  28. ## Output
  29. - json with following structure.
  30. ```
  31. {
  32.     "input": {
  33.         "amount": <float>,
  34.         "currency": <3 letter currency code>
  35.     }
  36.     "output": {
  37.         <3 letter currency code>: <float>
  38.     }
  39. }
  40. ```
  41. ## Examples
  42.  
  43. ### CLI
  44. ```
  45. ./currency_converter.py --amount 100.0 --input_currency EUR --output_currency CZK
  46. {  
  47.     "input": {
  48.         "amount": 100.0,
  49.         "currency": "EUR"
  50.     },
  51.     "output": {
  52.         "CZK": 2707.36,
  53.     }
  54. }
  55. ```
  56. ```
  57. ./currency_converter.py --amount 0.9 --input_currency ¥ --output_currency AUD
  58. {  
  59.     "input": {
  60.         "amount": 0.9,
  61.         "currency": "CNY"
  62.     },
  63.     "output": {
  64.         "AUD": 0.20,
  65.     }
  66. }
  67. ```
  68. ```
  69. ./currency_converter.py --amount 10.92 --input_currency £
  70. {
  71.     "input": {
  72.         "amount": 10.92,
  73.         "currency": "GBP"
  74.     },
  75.     "output": {
  76.         "EUR": 14.95,
  77.         "USD": 17.05,
  78.         "CZK": 404.82,
  79.         .
  80.         .
  81.         .
  82.     }
  83. }
  84. ```
  85. ### API
  86. ```
  87. GET /currency_converter?amount=0.9&input_currency=¥&output_currency=AUD HTTP/1.1
  88. {  
  89.     "input": {
  90.         "amount": 0.9,
  91.         "currency": "CNY"
  92.     },
  93.     "output": {
  94.         "AUD": 0.20,
  95.     }
  96. }
  97. ```
  98.  
  99. ```
  100. GET /currency_converter?amount=10.92&input_currency=£ HTTP/1.1
  101. {
  102.     "input": {
  103.         "amount": 10.92,
  104.         "currency": "GBP"
  105.     },
  106.     "output": {
  107.         "EUR": 14.95,
  108.         "USD": 17.05,
  109.         "CZK": 404.82,
  110.         .
  111.         .
  112.         .
  113.     }
  114. }
  115. ```
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top