Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """Escribir una función que tome como argumento un fichero. En cada línea del fichero habrá un número entero (negativo o positivo).
- La función leerá todos los números y devolverá el máximo"""
- def maximo(fichero):
- fp=open(fichero)
- linea=fp.readline()
- a=int(linea)
- while linea:
- b=int(linea)
- print(b)
- if a<b:
- a=b
- linea=fp.readline()
- fp.close()
- return a
- print(maximo("maximo ficheros.txt"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement