So, I'm trying to make a program where I have a dictionary like below. The thing is, the user should be able to add a value to one of the pre-existing dictionaries - either a string or another dictionary. I don't think I'd be having as much trouble except I'd like more dictionaries to be able to added as a value to student, and then more dictionaries into the one made in that, etc. etc. So basically I won't know how many dictionaries are being added and how far down that line goes, so I don't think I can just hard code in to add to that?
Sorry if I'm not making much sense, but the idea is basically that the user would start out at cities and be prompted to add a city. From there, they could either sort of 'go into' cities and add a school, or add an additional city and so on. Just really struggling on how to implement this, and I don't want to use any sort of imports.
I'm pretty new to Python so sorry if this seems really stupid.
cities = {
"city_1": {
"school_1": {
"class_1":{
"student_1": {
"name": "Joe"
},
"student_2": {
"name": "Tim"
}
}
},
"school_2": {
"class_1": {
"student_1": {
"name": "Joe"
},
"student_2": {
"name": "Tim"
}
}
}
},
"city_2": {
"school_1": {
"class_1": {
"student_1": {
"name": "Sarah"
},
"student_2": {
"name": "Jake"
}
},
"class_1": {
"student_1": {
"name": "Sarah"
},
"student_2": {
"name": "Jake"
}
}
}
}
}