[Learn Swift/Arrays & Sets/School Roster] optional challange 1

/*
I am completely new to coding and I have some questions regarding sets which I can’t figure out.
*/

var spanish101: Set = [“Angela”, “Declan”, “Aldany”, “Alex”, “Sonny”, “Alif”, “Skyla”]
var german101: Set = [“Angela”, “Alex”, “Declan”, “Kenny”, “Cynara”, “Adam”]
var advancedCalculus: Set = [“Cynara”, “Gabby”, “Angela”, “Samantha”, “Ana”, “Aldany”, “Galina”, “Jasmine”]
var artHistory: Set = [“Samantha”, “Vanessa”, “Aldrian”, “Cynara”, “Kenny”, “Declan”, “Skyla”]
var englishLiterature: Set = [“Gabby”, “Jasmine”, “Alex”, “Alif”, “Aldrian”, “Adam”, “Angela”]
var computerScience: Set = [“Galina”, “Kenny”, “Sonny”, “Alex”, “Skyla”]

// Write your code below :apple:
var sevenPlus = 0
var classSet:Set = [spanish101, german101, englishLiterature, computerScience, artHistory, advancedCalculus]

for lesson in classSet {
if lesson.contains(“Skyla”) {
lesson.remove(“Skyla”)
}
}

/*
I used the above code to remove “Skyla” from courses that she is in and the following error occurs, indicating that the sets are constants and immutable. They are created with prefix var and I wonder why this occurs. And if possible, could anyone help me with the solution: is it not viable to do it this way or how do I convert the constant sets to variable.
*/

Roster.swift:17:5: error: cannot use mutating member on immutable value: ‘lesson’ is a ‘let’ constant
lesson.remove(“Skyla”)
^~~~~~

Thank you in advance for your help!

I invite you to read this answer

Thank you so much! :grin: