-
-
Save ivlevdenis/1ef1d776732abc8b7e770db4da24233a to your computer and use it in GitHub Desktop.
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
n = int(input('Введите колчество студентов: ')) | |
quantity = 0 | |
score_sum = 0 | |
lines = [] | |
with open('students.txt','w+') as file: | |
for _ in range(n): | |
first_name = input('Введите имя: ') | |
second_name = input('Введите фамилию: ') | |
mark_math = int(input('Оценка по математике: ')) | |
mark_fiz = int(input('Оценка по физике: ')) | |
mark_his = int(input('Оценка по истории: ')) | |
lines.append(f'{first_name} {second_name} {mark_math} {mark_fiz} {mark_his}') | |
score_sum += mark_math + mark_fiz + mark_his | |
if mark_fiz != 2: | |
quantity += 1 | |
avg_score = score_sum / n * 3; | |
lines.append(f'Количество студентов не имеющий 2 по физике: {quantity}') | |
lines.append(f'Средний балл: {avg_score}') | |
file.writelines(lines) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment