I have been trying a lot but exhausted.
Need to find unique values in list without using any inbuilt method or inbuilt-properties.
By default my list will be in sorted format only.
My code :
lst = [1, 2, 2, 3, 4, 4, 5] `
i = 0
while i < len(lst):
if lst[i] < lst[i+1]:
print(lst[i])
else:
print(lst[i+1])
i+=1
i+=1
The above code gives me output only upto 4 -->
1,2,3,4.
How do i need to print my 5
.
I need to only use comparison approach to design my code.
left_value < right_value
Help me to correct my above code.
1