1

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"]
Ghilas BELHADJ
  • 13,412
  • 10
  • 59
  • 99
Keegs
  • 460
  • 6
  • 12

0 Answers0