Advertisement
TheDoskz

Untitled

Sep 22nd, 2021
584
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. import csv
  2. def read_csv(filename):
  3.     x=[]
  4.     with open(filename) as csvfile:
  5.         spamreader = csv.reader(csvfile)
  6.         for i in spamreader:
  7.             x.append(float(i[0]))
  8.     return x
  9.  
  10. def max_hui(x):
  11.     max=0
  12.     for i in x:
  13.         if max<i:
  14.             max=i
  15.     return max
  16.  
  17. def min_hui(x):
  18.     min=1000
  19.     for i in x:
  20.         if min>i:
  21.             min=i
  22.     return min
  23.  
  24. def sred(x):
  25.     sum=0
  26.     for i in x:
  27.         sum+=i
  28.     sr=sum/len(x)
  29.     return sr
  30.  
  31. x=read_csv('r1z1.csv')
  32. max_hui(x)-min_hui(x)
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement