Skip to content

Instantly share code, notes, and snippets.

@nhuntwalker
Last active October 20, 2017 18:31
Show Gist options
  • Save nhuntwalker/8b97a30fc9ba062b95327dfc1df29be4 to your computer and use it in GitHub Desktop.
Save nhuntwalker/8b97a30fc9ba062b95327dfc1df29be4 to your computer and use it in GitHub Desktop.
Write a function that will take a query string as an argument and return the key-value pairs as a dictionary.
query = ?one=1&two=2
parameters(query) => {'one': '1', 'two': '2'}
query = ?foods=butter&foods=cake&foods=chicken
parameters(query) => {'foods': ['butter', 'cake', 'chicken']}
query = ?username=codefellows&password=learnmorefaster&courses=code201&courses=code301&courses=code401-python&courses=code401-javascript&courses=code401-dotnet
parameters(query) =>
{
'username': 'codefellows',
'password': 'learnmorefaster',
'courses': ['code201', 'code301', 'code401-python', 'code401-javascript', 'code401-dotnet']
}
Submit link to this file to nicholas@codefellows.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment