SHARE
TWEET

ex1

a guest May 23rd, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. archivo = open("dataestudiantes1.csv","r")
  2. counter=0
  3. for linea in archivo:
  4.     if counter==0:
  5.         pass
  6.     else:
  7.         #print linea
  8.         lista=linea.strip().split(",")
  9.         ID= lista[0].replace('"',"")
  10.         RUT_ID= lista[1].replace('"',"")
  11.         nombre_est= lista[2].replace('"',"")
  12.         #print lista[3].replace('"',"").replace(" ","")
  13.         nota1= float(lista[3].replace('"',"").replace(" ",""))
  14.         nota2= float(lista[4].replace('"',"").replace(" ",""))
  15.         nota3= float(lista[5].replace('"',"").replace(" ",""))
  16.         nota4= float(lista[6].replace('"',"").replace(" ",""))
  17.         nota5= float(lista[7].replace('"',"").replace(" ",""))
  18.         promedio=round(((nota1+nota2+nota3+nota4+nota5)/5),1)
  19.         print nombre_est, promedio
  20.     counter+=1
  21.        
  22. #print "el promedio es", nota1+nota2
  23. archivo.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top