0
students = ["Terri", "Gerald", "Sam"]
classes = {'Math': '98', 'Science': '80', 'Literature': '75'}

now I want to be able to know the grade that Terri got in his math class and I want the answer to be 98, dict['Terri']['Math'] = 98.

How would I do that? Is there a way around this where I can convert this to other types of collections? TY

I would like the nested dictionary to read like:

{Terri: Math:98, Science: 80....} # and so on....
Tom
  • 8,310
  • 2
  • 16
  • 36
  • 1
    You can certinly do it. Try `{'Terri':{'Math':98,'Physics':90}, 'Gerald':{'Math':98,'Physics':85}}` – Epsi95 Jan 28 '21 at 16:43
  • Does this answer your question? [How do you create nested dict in Python?](https://stackoverflow.com/questions/16333296/how-do-you-create-nested-dict-in-python) – Tom Jan 28 '21 at 16:46

0 Answers0