Write a function accordian(l) that takes as input a list of integer l and returns True if the absolute difference between each adjacent pair of elements strictly increases.
def accordian(l):
for i in range(len(l)):
diff = []
for i in range(len(diff)):
diff = l[i] - l[i+1]
if diff[i] < diff[i+1]:
return True
else:
return False
print(accordian([1,3,7,2,9]))
Output: "None"
diffis empty, giving you nothing to iterate over, meaning your returns are still not reached.for i in range(len(diff)):withfor i in range(len(l)):otherwise your function will never get to areturn. Also I guess it should bediff[i] = l[i] - l[i+1]instead ofdiff = l[i] - l[i+1].