I do not know if I understand your question well, but I think you need a list of subjects and a dictionary for each subject. The result would look something like this:
[{"nome": "Matemática",
"serie": "quinto ano",
"professor": "Paulo",
"alunos":[{"nome": "Maria Antônia", "media": 7}, {"nome":"Renato", "media": 8}],
"mediaTotal":7.5},
{"nome": "Matemática",
"serie": "sexto ano",
"professor": "Rosa",
"alunos":[{"nome": "Suzana", "media": 7}, {"nome":"Claudia", "media": 8}],
"mediaTotal":7.5}]
To mount this structure, I thought of a type code like this:
nMaterias = int(input("digite o número exato de matérias que há nessa série"))
materias = []
for i in range(nMaterias):
materia = {
"nome": input("Qual o nome da matéria %s: " %(i+1)),
"serie": input("Qual a série da matéria %s: " %(i+1)),
"professor": input("Qual o nome do professor da matéria %s: " %(i+1)),
"alunos": None,
"mediaTotal": input("Qual a média da matéria %s: " %(i+1)),
}
materias.append(materia)
print (materias)
Well, of course it would need a bigger work to do another loop to fill each student and the total average could be done with a quick calculation of the filled averages.
In addition, in your code, you can not store print () in a variable. First you store the input in the variable and then you give a print () command.