Below is the question and my attempted answer
5.4 Use the list of module titles from the previous exercise to create a for loop. It should ask the user for every title whether they would like to keep the title or delete it. Delete the titles which the user no longer wants.
Answer
# creating and modifying a list
#
module_list = ["Natural Language Processing", "Wireless Communication Systems", "Final Year Project", "Research Studies", "Internet Technologies", "Applied Mobile Technologies"]
nLoops = 6
for i in range(nLoops):
module_title = input(" Please enter a module title : ")
new_item = input("Which item would you like to delete?\
Please input the name of the item: ")
if new_item in shopping_list:
module_list.remove(new_item)
print (new_item, "has been deleted")
else:
print (new_item, "cannot be deleted because it is not in the module list")
print ("The module list has the following",\ len(module_list), "items:", module_list)
I keep getting an error expected an indented block.
Please help me fix this error and let me know if my code answers the 5.4 question
Thanks
Mark