
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

This program takes five full names from the user, extracts the last names, sorts them alphabetically, and prints the sorted list of last names. """
last_names = []
for i in range(5): full_name = input("Name: ") last_name = full_name.split()[-1] last_names.append(last_name)
last_names.sort()
print(last_names)