void ExibirTitulo(string titulo)
{
int quantidadeLetras = titulo.Length;
string asteriscos = string.Empty.PadLeft(quantidadeLetras, '*');
Console.WriteLine(asteriscos);
Console.WriteLine(titulo);
Console.WriteLine(asteriscos);
}
var notasAlunos = new Dictionary<string, Dictionary<string, List<int>>>()
{
{"Ana", new Dictionary<string, List<int>>() {
{"C#", new List<int>{8, 7, 6 } },
{"Java", new List<int>{7, 6, 5 } },
{"Python", new List<int>{9, 8, 8 } }
}},
{"Maria", new Dictionary<string, List<int>> {
{"C#", new List<int>{6, 5, 4 } },
{"Java", new List<int>{8, 7, 6 } },
{"Python", new List<int>{6, 10, 5 } }
}},
{"Luiza", new Dictionary<string, List<int>> {
{"C#", new List<int>{2, 3, 10 } },
{"Java", new List<int>{8, 8, 8 } },
{"Python", new List<int>{7, 7, 7 } }
}}
};
void ExibirMediaDasNotas ()
{
ExibirTitulo("Média das notas dos alunos");
foreach (string aluno in notasAlunos.Keys)
{
Console.Write($"\n{aluno}: \n");
foreach (string linguagem in notasAlunos[aluno].Keys)
{
double media = notasAlunos[aluno][linguagem].Average();
Console.WriteLine($"Média de {linguagem}: {media:F2}");
}
}
}
ExibirMediaDasNotas();