Suppose you have two list like the lists below that are sorted in ascending order:
List1=[1, 2, 5, 7, 8, 13, 16, 17, 20, 21]
List2=[3, 3, 3, 5, 6, 8, 10, 12, 13, 16]
I want python to 1- find the minimum element(s) in each list
2- convert the value of the min element(s) to the second number greater than it
3- repeat until all the elements in a list are equal to the last(greatest) one
As an example for list1:
1- min=1
2- List1=[2, 2, 5, 7, 8, 13, 16, 17, 20, 21]
repeat:
min=2,2
list1=[5, 5, 5, 7, 8, 13, 16, 17, 20, 21]
.
.
.
3- List1=[21, 21, 21, 21, 21, 21, 21, 21, 21, 21]
An example for list2:
1- min=3, 3, 3
2- List2=[5, 5 5, 5, 6, 8, 10, 12, 13, 16]
repeat:
min=5,5,5,5
List2=[6, 6, 6, 6, 6, 8, 10, 12, 13, 16]
.
.
.
3- List2=[16, 16, 16, 16, 16, 16, 16, 16, 16, 16]
I would highly appreciate if someone could help