//1.
Dictionary<string, List> aluno = new Dictionary<string, List>();
aluno.Add("C#", [10, 8, 9, 8]);
int soma = 0;
float media = 0;
foreach (var value in aluno)
{
soma += value.Value.Sum();
media = (float)soma / 4;
}
Console.WriteLine(media);
//2.
string nomeProduto = Console.ReadLine()!;
Dictionary<string, int> produtos = new Dictionary<string, int>()
{
{"camisa", 40 },
{"calca", 50 },
{"bota", 20 }
};
foreach (var value in produtos)
{
if(nomeProduto.Contains(value.Key))
{
Console.WriteLine(value.Value);
}
}
//3.
Dictionary<string, string> perguntas = new Dictionary<string, string>
{
{"Qual a cor do Céu de dia?", "azul" },
{"quanto é 2 + 2", "4" },
};
Console.WriteLine("Responda as perguntas a seguir:\n");
foreach (var item in perguntas)
{
Console.WriteLine(item.Key);
string resposta = Console.ReadLine().ToLower()!;
while (resposta != item.Value)
{
Console.WriteLine("Tente novamente:");
resposta = Console.ReadLine().ToLower()!;
}
Console.WriteLine("Parabéns, você acertou!\n");
}
//4.
Dictionary<string, List> loguin = new Dictionary<string, List>();
Console.WriteLine("Faca seu Loguin");
Console.WriteLine($"Digite seu Nome e senha");
Console.WriteLine("\nNome ");
string nome = Console.ReadLine()!;
Console.WriteLine("Senha: ");
int senha = int.Parse(Console.ReadLine());
loguin.Add(nome, new List {senha});