Given a list:
list = [220.32, 205.1, 204.6, 203.2, 203.75, 203.25, 203.75, 203.5] It is necessary to compare the elements of the list with each other in the loop and a larger element.
divided by smaller. But do not assign names to each element of the list.
My code does not allow this:
for i in list: if list[i] > list[i + 1]: a = (list[i] / list[i + 1] ) else: a = (list[i + 1] / list[i] ) print(a) Libraries cannot be used.
Throws an exception:
Traceback (most recent call last): File "", line 2, in
TypeError: list indices must be integers or slices, not
float`