def print_studs(students):
t = '{:<16}{:<8}{:<8}{}'
print(t.format('name', 'group', 'age', 'marks'))
print('\n'.join([t.format(s['name'], s['group'], s['age'], s['marks']) for s in students]))
def all_students(students):
return students
def students_avg(students, n):
return [s for s in students if sum(s['marks'])/len(s['marks']) > n]
print_studs(all_students(groupmates))
print()
print_studs(students_avg(groupmates, 4))