Looking for the classiest way to do this, just for fun. Say you have a list of names
and a location string:
Now you want to combine these into a list of tuples based on location:
[('george','live rpool'), ('paul','liverp ool'), ('john','liverp ool'), ('ringo','liver pool')]
Kind of like a zip function but with all values from names present and kind of like a map function but with the location used not None. So a little twist on some common functions. Thoughts?
Code:
names=['george', 'paul', 'john', 'ringo']
Code:
location='liverpool'
[('george','live rpool'), ('paul','liverp ool'), ('john','liverp ool'), ('ringo','liver pool')]
Kind of like a zip function but with all values from names present and kind of like a map function but with the location used not None. So a little twist on some common functions. Thoughts?
Comment