Answer the question
In order to leave comments, you need to log in
Why doesn't the max method output the maximum value?
*********input.txt***************
100 500 1000
************************ ******
fin = open('input.txt',)
fout = open('output.txt','w')
a = []
a = fin.readline().split(' ')
fg = min(a)
fgt = max(a)
print('min =' , fg, ',' , ' max =' , fgt)
fin.close()
fout.close()
********output. txt**********
min = 100 , max = 500
******************************
Answer the question
In order to leave comments, you need to log in
Because you don’t have numbers, but strings, you must first translate each into a number
for i in range(len(a)):
a[i] = int(a[i])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question