Created
May 5, 2019 17:33
-
-
Save aananya27/d8ae83fa4fc4bd1fc1607c1f7ab35ca1 to your computer and use it in GitHub Desktop.
Finding Gold Sequentially
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections | |
from pprint import pprint | |
Miners = collections.namedtuple('Miners',[ | |
'name', | |
'age', | |
'specialisation' | |
]) | |
Miners = ( | |
Miners(name = 'Blake', age = '43', specialisation = 'Excavating'), | |
Miners(name = 'Stephen', age = '27', specialisation = 'Surface mining'), | |
Miners(name = 'Adam', age = '26', specialisation = 'Subsurface mining'), | |
Miners(name = 'Joseph', age = '29', specialisation = 'Surface mining'), | |
Miners(name = 'Joe', age = '28', specialisation = 'Subsurface mining'), | |
Miners(name = 'Michael', age = '32', specialisation = 'Excavating'), | |
Miners(name = 'Jeff', age = '27', specialisation = 'Excavating'), | |
) | |
def gold_diggers(gm): | |
return {'name':'Mr.'+gm.name , 'who is': gm.age , 'working currently on': gm.specialisation + " gold " } | |
gold_miners = tuple(map( gold_diggers, Miners )) | |
pprint(gold_miners) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment