Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# -*- coding: utf-8 -*-
def clean(li):
return map(float, li)
def avg(li):
return sum(clean(li)) / len(li)
def main():
with open('./in.txt', 'r') as input_file, \
open('./out.txt', 'w') as output_file:
line = input_file.readline()
while line:
num, name, chinese, english, math = line.split()
li = clean([chinese, english, math])
% (num, name, sum(li), avg(li)))
line = input_file.readline()
if __name__ == '__main__':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.