Firstly, linking to the original example is a good idea. I am using line numbers from the original example.
Lines 1 to 8 define a class called Song. A class is exactly like a blueprint for making a new object. Every function that you add to a class will be added to the object when you make the object.
Song
is on the right side on line 10 and 14 because you are making new Song objects, and putting them in variables. You don't even need to put the Song object inside a variable. The following would work just fine:Song(["Do","Re","Mi"]).sing_me_a_song()
What is the difference between this:
print("Hi!")
And this?
message = "Hi!"
print(message)
In the one you pass a value directly, and in the other you pass a variable that contains the value. Just like
"Hi!"
is a value,["Do","Re","Mi"]
is a value too. How would you pass the second value to a new Song object?