A file named numbers.txt contains an unknown number of lines, each consisting of a single positive integer. Write some code that reads through the file and stores the largest number read in a variable named maxvalue.
** PYTHON**

A file named numberstxt contains an unknown number of lines each consisting of a single positive integer Write some code that reads through the file and stores class=

Respuesta :

f = open("numbers.txt", "r")

lst = [int(x) for x in f.read().splitlines()]

maxvalue = max(lst)

This works for me. Best of luck. If you want to test the code in an ide, use print(maxvalue) at the end of the code to see the value of your maxvalue variable.