Redomine

средние оценки

Jul 4th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. with open(r'C:\Pyton\dataset_3363_2.txt') as inf:
  2. ishod=[]
  3. for line in inf:
  4. line=line.strip().split(';')
  5. ishod=ishod+line
  6.  
  7. summa1=[] #собираю оценки по каждому из предметов в свой список чтоб потом суммировать
  8. summa2=[]
  9. summa3=[]
  10.  
  11. s1, s2, s3= 1, 2, 3
  12. for x in range(len(ishod)):
  13. if s1>(len(ishod)):break
  14. summa1.append(int(ishod[s1]))
  15. summa2.append(int(ishod[s2]))
  16. summa3.append(int(ishod[s3]))
  17.  
  18.  
  19.  
  20. print((int(ishod[s1])+int(ishod[s2])+int(ishod[s3]))/3)
  21. s1+=4
  22. s2+=4
  23. s3+=4
  24.  
  25.  
  26. print(sum(summa1)/len(summa1), sum(summa2)/len(summa2), sum(summa3)/len(summa3))
Advertisement
Add Comment
Please, Sign In to add comment