Skip to content

Instantly share code, notes, and snippets.

@ivlevdenis
Created May 12, 2018 15:32
Show Gist options
  • Save ivlevdenis/1ef1d776732abc8b7e770db4da24233a to your computer and use it in GitHub Desktop.
Save ivlevdenis/1ef1d776732abc8b7e770db4da24233a to your computer and use it in GitHub Desktop.
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