Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
1liner solution in Clear category for Not in Order by mikaeldovbnia
def not_order(data):
return sum(i != a for a, i in zip(data, sorted(data)))
print("Example:")
print(not_order([1, 1, 4, 2, 1, 3]))
assert not_order([1, 1, 4, 2, 1, 3]) == 3
assert not_order([]) == 0
assert not_order([1, 1, 1, 1, 1]) == 0
assert not_order([1, 2, 3, 4, 5]) == 0
print("The mission is done! Click 'Check Solution' to earn rewards!")
Jan. 18, 2023
Comments: