Use input() function to ask the users to input the courses and professors in this semester

Question: Use input() function to ask the users to input the courses and professors in this semester, until the users input “done” as an end. Put the courses and the professor names into two separate lists and print out these lists as follows (don’t print lists literally). Then print out the following statements using for loop in each list. Please note there are no newlines in the first statement, while there are ‘->‘ symbols in the second statement. You cannot print the statements literally.

Solution:


course_list = []
professor_list = []
while(True):
    course = input("Please enter the courses you are taking in this semester :")
    if(course=="done"):
        break;
    professor = input("Please enter the professor's name for the course:")
    course_list.append(course)
    professor_list.append(professor)
   
print("The list of courses is : ", course_list)
print("The list of Professors is: ", professor_list)
print("The course you are taking int this semester are:",end=" ")
for i in course_list:
    print(i,end=",")
print()
print("The profesor of these courses are ")
for i in professor_list:
    print(str(i)+"->")

Output: