Write a function n called is_descending that takes a list of numbers and returs True if the elements are in descending order and False if not. It should just check the users input if its in descending order and returns true if it is and if not false
def is_descending(L):
prev = L[0]
for i in range(1, len(L)):
if prev <= L[i]:
return False
prev = L[i]
return True
line = input()
L = [int(w) for w in line.split()]
if is_descending(L):
print('The input is descending')
else:
print('The input is not descending')
Comments
Leave a comment