The list in my actual code is too large.
Is there a way to get the desired output.
An efficient way will be preferred.
Here is my code:
import sys
def function():
listt=["the","cat","sat","on","the","mat","which","is","on","the","floor"]
print (sorted(set(listt)))
function()
Output:['cat', 'floor', 'is', 'mat', 'on', 'sat', 'the', 'which']
Expected Output:["the","cat","sat","on","mat","which","is","floor"]