I know this doubt looks quite easy but i just cant get my head to wrap around it. I was just fooling around with python sorting, when i noticed this.
If I gave in the input as 21 ,8, 4
. The output i would receive would be 21, 4,8
. Not 4,8,21
. What i am assuming is that python is only taking the first digit and comparing, but that is not what i want. How do i fix this problem?
lst=list()
i=0
while i < 3:
number=input("Give me a number: \n")
lst.append(number)
i=i+1
print("\n")
lst.sort()
print("The list of ordered numbers are:")
for j in lst:
print(j)