Is there any way in python where the elements of the list don't get changed.
For eg, integers must remain integers and string must remain string, but this should be done in same program.
The sample code would be:
print("Enter the size of the list:")
N = int(input())
for x in range(N):
x = input("")
the_list.append(x)
the_list.sort()
print(the_list)
Result: the_list = ['1','2','3']
is the list of integers where integers have converted to strings which is wrong.
But strings of list must remain strings.
mylist_int.