Diferent result on same code as lecture
That's the code i've wrote:
data = [53,76,25,98,56,42,69,81]
find_max = 0
for num in data:
if num > find_max:
find_max = num
print("Max value is", find_max)
And i get this result (3 lines checked):
Max value is 53
Max value is 76
Max value is 98
Instead of that (1 line only):
Max value is 98
I'd like to know why or what i'm not doing properly?
1 answers ( 0 marked as helpful)
Hello Albertina,
'print' must be aligned with 'for'
find_max = 0
for num in data:
if num > find_max:
find_max = num
print('Max value is',find_max)