x = [5 ,8 , 3 ,29, 445, 54]
def high():
for num in x:
if num > z:
z = num
return z
high()
print(z)
I want a function that returns the highest number from a list without using the max() inbuilt python function. Whenever I try and run this, i get this error:
line 6, in high
if num > z:
UnboundLocalError: local variable 'z' referenced before assignment
numis larger thanz, but what isz?