Advertisement
elcocodrilotito

numero alumnos

Dec 14th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. def numero_alumnos(archivo):
  2.     fp=open(archivo+".txt")
  3.     linea=fp.readline()
  4.     D=dict()
  5.     while linea:
  6.         for i in range(3,len(linea.split())):
  7.             if linea.split()[i] in D:
  8.                 D[linea.split()[i]]+=1
  9.             else:
  10.                 D[linea.split()[i]]=1
  11.         linea=fp.readline()
  12.     return D
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement