names = ["Eren", "luffy", "goku"]
print(names.sort())
Output: None
Why the sort method can't sort the list?
About: Enthusiastic person in python programming and a beginner in machine learning
names = ["Eren", "luffy", "goku"]
print(names.sort())
Output: None
Why the sort method can't sort the list?
It's sorting the list however not returning anything, that's why
None
.If you want the sorted list to be returned, use
sorted()
method.