Respuesta :
Answer:
size = int(input("How many names will be there? "))
names = []
for _ in range(0, size):
name = input("Enter a name: ")
names.append(name)
names.sort()
print(names[0] + " " + names[-1])
Explanation:
* The code is in Python
- Ask the user for the number of the name
- Initialize an empty list that will hold the name entered
- Inside the for loop, get the names and put them in the names array
- When all the names are entered, sort them and print the first and last of the name
The program is an illustration of loops.
Loops are used to perform repetitive operations.
The program in Python, where comments are used to explain each line is as follows:
#This gets the count of names to be input
count = int(input("Total names: "))
#This initializes the list of names
names = []
#This iteration gets all names
for i in range(count):
#This gets a name
name = input("Enter a name: ")
#This appends it to the list
names.append(name)
#This sorts the name
names.sort()
#This prints the first and the last name, alphabetically
print(names[0] + " " + names[-1])
At the end of the program, the first and the last names are printed.
Read more about similar programs at:
https://brainly.com/question/19821462