46.2k views
0 votes
Write and execute a short program to do the following: - Read three 3-letter names from the keyboard and print them in reverse alphabetical order (high to low) - Run your program twice, with the names entered exactly as listed below, and in the given order. The list in Run \#1 has all of the names capitalized, and the list in Run \#2 has two of the names beginning with lower-case letters. - Submit the program and evidence of it running properly for the two sets of data. - Did the program produce the same results for both lists? Why?

1 Answer

0 votes

Final answer:

To solve this problem, you can use a programming language like Python to read three 3-letter names from the keyboard, sort them in reverse alphabetical order, and print the sorted names. The program should produce the same results for both capitalized and lowercase names.

Step-by-step explanation:

To solve this problem, you can use a programming language like Python. Here is an example of a program that reads three 3-letter names from the keyboard, stores them in a list, sorts the list in reverse alphabetical order, and then prints the sorted names:



names = []

for i in range(3):
name = input('Enter a 3-letter name: ')
names.append(name)

names.sort(reverse=True)

for name in names:
print(name)



You can run this program twice, with the names entered in the listed order. In Run #1, enter the names capitalized as follows: ABC, XYZ, DEF. In Run #2, enter the names as follows: abc, XYZ, def. The program should produce the same results for both lists because it sorts the names based on their alphabetical order, regardless of whether they are capitalized or not.

User Nikita Rybak
by
8.3k points