Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. file = input('Input file? ')
  2. file = open(file)
  3.  
  4. data = file.readlines()
  5.  
  6. for line in data:
  7.     line = line.split()
  8.     sum = 0
  9.     days = 0
  10.     print(line[1], '(ID#' + line[0] + ') worked ', end='')
  11.     for i in range(2, len(line)):
  12.         sum += float(line[i])
  13.         days += 1
  14.     print(round(sum, 1), 'hours (' + str(round(sum / days, 1)) + '/day)')
  15.     
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement