-1
I need to find the highest value in a list of 50 random numbers. To generate these numbers, I used the functions sample
and randint
. So to generate the list I use:
lista = [sample(range(0, 200), 50)]
And to find the biggest one I use:
mai = 0
for v in lista:
if v == 0:
mai = v
else:
if v > mai:
mai = v
print(f'O maior valor da lista é {mai}')
But whenever I use some of these functions it returns this error: TypeError: '>' not supported between instances of 'list' and 'int'
and if I generate a list manually, this method of finding the biggest one works perfectly, what can I do to get around this problem? I’ve tried to put the generated list inside another list and it still doesn’t work, if anyone can help I would be grateful.