Answer:
Here is an example of how you can create a StudentRoster application in Python:
# Define a function to get the student names
def get_student_names(num_students):
# Initialize an empty list to store the names
names = []
# Prompt the user for each student's name and add it to the list
for i in range(num_students):
name = input(f"Enter the name of student {i+1}: ")
names.append(name)
# Return the list of names
return names
# Main function
def main():
# Prompt the user for the number of students in the class
num_students = int(input("Enter the number of students in the class: "))
# Get the names of the students
names = get_student_names(num_students)
# Display the title
print("Student Roster:")
# Display the names of the students
for name in names:
print(name)
# Run the main function
if __name__ == "__main__":
main()
This code will prompt the user for the number of students in the class, and then prompt the user for each student's name. It will store the names in a list, and then display the title "Student Roster" followed by the names of the students.
Step-by-step explanation: