I want to print the shortest strings in a list. for example the output for:
names=["Hans", "Anna", "Vladimir", "Michael", "Ed", "Susan", "Janice", "Jo"]
will be
"Ed", "Jo"
The output for
names=["Hans", "Anna", "Vladimir", "Michael", "Ed", "Susan", "Janice", "Jo", "Al"]
will be:
"Ed", "Jo", "Al"
[x for x in names if x==min(names, key=len)]
will get only one of them, but will not help in cases where there is more than one.