I have hundreds of lists that look like that:
list_1 = [10,20,30,40,70,90,230,450] # sorted list example
list_2 = [10,20,40,30,70,230,90,450] # partially sorted list example
list_a = [20,450,90,30,70,230,10,40] # messy/unsorted list example
Some lists are sorted, partially sorted and some are completly unsorted. I want to get the lists that are sorted and partially sorted. I know how to check if a list is sorted:
if sorted(lst) == lst:
# code here
How do I get the partially sorted lists as well? How to define a threshold for what I mean with partially sorted? For example only 10% of numbers in a given list are not in correct order.