In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of November 23rd
(this exercise will still be available for submission after that deadline, but without counting towards your grade)
[to understand the context of this problem, you should read the class #06 exercise sheet]


In this problem you should submit a function as described. Inside the function do not print anything that was not asked!

[IP059] Church Members

Reverend Timothy Lovejoy, the steadfast and somewhat weary minister of the First Church of Springfield, finds himself in the midst of planning a community outreach event aimed at bringing together his congregation and promoting goodwill throughout Springfield. As he prepares for this important occasion, he decides that it would be fitting to recognize and highlight the different members of his church.

To kick off the event, Reverend Lovejoy thinks it would be a great idea to create a special presentation that features the names of church members. However, he wants to do something a bit unique: he plans to sort the names in decreasing order based on the length of each name. After all, he thinks, names can be quite telling, and it would add a humorous twist to the event. The longer names could be seen as those of devoted parishioners, while the shorter ones might represent the newcomers or those who haven’t been as involved in church activities.

The Problem

Write a function sort_strings(lst) that given a list lst of strings, sorts it in decreasing order of length (and in case of a tie by the increasing lexicographical order, that ist, if a and b are two strings with the same length and in python a<b then a should come before than b. Note that the function should change the list itself (and not return a new list) and that repeated strings mut be kept on the list.

Constraints

The following limits are guaranteed in all the test cases that will be given to your program:

1 ≤ |lst| ≤ 100       Length of list

Example Function Calls Example Output
lst1 = ["forty","two","is","the","meaning","of","life"]
sort_strings(lst1)
print(lst1)
lst2 = ["to","be","or","not","to","be","that","is","the","question"]
sort_strings(lst2)
print(lst2)
['meaning', 'forty', 'life', 'the', 'two', 'is', 'of']
['question', 'that', 'not', 'the', 'be', 'be', 'is', 'or', 'to', 'to']

Introduction to Programming (CC1024)
DCC/FCUP - University of Porto