Basically, the assignment asks for the program to open a file, find the largest number, and count the amount of numbers in the file. Our instructor has told us not to use array implementation and I'm not sure if my code counts as using it. I don't know how to convert it without using array implementations.
def main():
infile = open('numbers.dat', 'r')
numbers = []
for line in infile:
numbers.append(int(line))
infile.close()
largest = max(numbers)
print('The largest number in the file is: ',largest)
count = len(numbers)
print('The amount of numbers in the file is: ', count)
main()
See Question&Answers more detail:os