00:01
In this video, we will be creating a song class in python.
00:06
So to get started, we need to first create our class, which we are naming it a song.
00:13
Next, we want to create our constructor.
00:17
And the constructor in programming is used for instigating an object.
00:25
So to do this, we need to write a function and then our function name, which is i -n -i -t and then you want to do self and then the name of our variables we need.
00:53
So artist, genre, album, and now we do self -dartist equals artist, and we do the same for the rest.
01:16
So genre equals genre, album equals album, and lastly, self -dot month equals month.
01:36
All right.
01:38
Now we can come out of the constructor and we can create another function.
01:46
This function will be just songs and we're just going to return.
01:52
So we're returning self, artist, and all our other variables.
02:08
You can also include message, so artist, comma, oops, copy paste this.
02:23
We can change our message and variables accordingly.
02:30
Great.
02:31
I'm going to do genre, album, and length.
02:53
I can come out of here and that's pretty much it for our class.
02:59
We can then come out of our class and then create variables for our user.
03:06
So say our user wants to enter information.
03:14
So to do this, we need to get the input.
03:18
So enter artist, create variables for all of our variables...