Question: Add comments to explain what each line is doing. A comment in Python starts with a # . courses = [ Intro to Computer

Add comments to explain what each line is doing. A comment in Python starts with a #.
courses =["Intro to Computer Science", "Program Design", "Web Design", "Object-Oriented Programming", "Data Structures and Algorithms"]
index =0
vowels =['A','E','I','O','U']
favouriteCourses =[]
while index < len(courses):
theCourse = courses[index]
if theCourse[0] in vowels:
favouriteCourses.append(theCourse)
index +=1
print("List of my favourite courses:", favouriteCourses)
#Note in particular the line that says if theCourse[0] in vowels: Can you explain what this
#line does? How does the program decide which courses are favourites? Would a course called
#"Graphics" be a favourite? Try adding it to the list and find out!
#Modify the program above so that it selects favourite courses with: names longer than 12
#letters and also have the letter 'g' in the course name.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!