I have a dictionary (named dict1) that has the following structure:
dict1 = {
'Classroom': [{
'Subject': "Calculus",
'Students': [
{'Name': "Joe", 'Age': 12, 'Weight': 126, 'Gender': "Male"},
{'Name': "Doug", 'Age': 13, 'Weight': 95, 'Gender': "Male"},
{'Name': ..., 'Age': ..., 'Weight': ..., 'Gender': ...}
]
}]
}
The list (which contains name, age, weight, and gender) within this dictionary is very long, and I wanted to parse the Name, Age, and Gender out, and append them onto another list like this:
mylist = [("Joe", 12, "Male"), ("Doug", 13, "Male"), ... ]
I tried seraching online and tinkered around with code such as this:
mylist = []
dict2 = dict1['Classroom'][0]['Students'][0]['Name']
mylist.append(dict2)
But what happens is that it only appends the first name (Joe). Furthermore, I'm not sure how to parse three items (name, age, and gender) at the same time. Does anyone have a way to do this without having to use libraries?