In: Computer Science
python:
people = {
"Molan": {
"age": 46,
"seIdentity": "Dan Jukes",
"supowers": [
"Radiaon Immunity",
"Turni tiny",
"Radiati blast"
]
},
"Etlame": {
"age": 1800,
"seIdentity": "Unknown",
"supowers": [
"Immortality",
"Heat Immunity",
"Inferno",
"Teleportation",
"Interdi travel"
]
}
#output all people ages as set
# out old people age from dict with name
Please find the answer below.
Please do comments in case of any issue. Also, don't forget to rate
the question. Thank You So Much.
people = {
"Molan": {
"age": 46,
"seIdentity": "Dan Jukes",
"supowers": [
"Radiaon Immunity",
"Turni tiny",
"Radiati blast"
]
},
"Etlame": {
"age": 1800,
"seIdentity": "Unknown",
"supowers": [
"Immortality",
"Heat Immunity",
"Inferno",
"Teleportation",
"Interdi travel"
]
}
}
ageSet =set()
for p in people:
ageSet.add(people[p]["age"])
print("ageSet = ",ageSet)
people = {
"Molan": {
"age": 46,
"seIdentity": "Dan Jukes",
"supowers": [
"Radiaon Immunity",
"Turni tiny",
"Radiati blast"
]
},
"Etlame": {
"age": 1800,
"seIdentity": "Unknown",
"supowers": [
"Immortality",
"Heat Immunity",
"Inferno",
"Teleportation",
"Interdi travel"
]
}
}
for p in people:
print("Age = ",people[p]["age"]," Name = ",p)