Guest User

Untitled

a guest
Oct 21st, 2017
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. Write a function that will take a query string as an argument and return the key-value pairs as a dictionary.
  2.  
  3. query = ?one=1&two=2
  4. parameters(query) => {'one': '1', 'two': '2'}
  5.  
  6. query = ?foods=butter&foods=cake&foods=chicken
  7. parameters(query) => {'foods': ['butter', 'cake', 'chicken']}
  8.  
  9. query = ?username=codefellows&password=learnmorefaster&courses=code201&courses=code301&courses=code401-python&courses=code401-javascript&courses=code401-dotnet
  10. parameters(query) =>
  11. {
  12. 'username': 'codefellows',
  13. 'password': 'learnmorefaster',
  14. 'courses': ['code201', 'code301', 'code401-python', 'code401-javascript', 'code401-dotnet']
  15. }
  16.  
  17. Submit link to this file to nicholas@codefellows.com
Add Comment
Please, Sign In to add comment