Last active
June 17, 2021 14:48
-
-
Save natan20200679/b2dcdd0f0a34912480ec989f969a221b to your computer and use it in GitHub Desktop.
Lista de Exercícios Python Brasil
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ Faça um programa que calcule o número médio de alunos por turma. Para isto, peça a quantidade de turmas e a quantidade de | |
| alunos para cada turma. As turmas não podem ter mais de 40 alunos. """ | |
| # O código está executando o cálculo errado, e não estou conseguindo identificar o erro. | |
| t = int(input("Quantidade de turmas: ")) | |
| T = 1 | |
| A = 1 | |
| for i in range(0, t): | |
| print("Turma: ", T) | |
| a = int(input("Quantidade de alunos: ")) | |
| A += 1 | |
| while a > 40: | |
| print("Turma ", T, " (máximo de alunos por turma: 40!)") | |
| a = int(input("Quantidade de alunos: ")) | |
| T += 1 | |
| m = A / T | |
| print("Média Alunos/Turma: ", m) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment