From the course: Getting Started with Python Object Oriented Programming: A Hands-On Approach

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Challenge: Creating objects from a user-defined class

Challenge: Creating objects from a user-defined class

(bright music) - [Instructor] Now for your first challenge for this course, you're going to be creating objects from a user-defined class. Now this is actually fairly straightforward, this first challenge. Code on the screen is from the code from chapter one. And you can see this is how we created our first two cards. We called the constructor by using the class name, and we passed in the arguments Ace, Spades for the first one and Queen and Hearts for the next one. What you need to do in this task is to simply create two more instances of the card class. So they're going to have new names, perhaps most logically card three and card four, but it's your choice and you're going to use basically the same syntax to create two more instances of the card class. Now, the way that we structured the code for all of these challenges in this course is in the start folder for the video corresponding to the challenge. So in this case, in 01_03, you can see an example of the code, which is the…

Contents