Question: Setup First, open up your command prompt/terminal Within your command prompt/terminal, run the following command: cd desktop Next, run the following: cd python_course Run the

Setup

First, open up your command prompt/terminal

Within your command prompt/terminal, run the following command:

cd desktop 

Next, run the following:

cd python_course 

Run the following to create a new directory for this project:

mkdir lesson_six_handson 

Open up a new window in VSCode.

Click on the "Explorer" button on the left-hand side of the VSCode window.

Click the Open Folder button.

Select the lesson_six_handson directory within the python_course folder on your Desktop. Click the Open button.

Create a new file named main.py by one of the following three ways:

To the right of LESSON_SIX_HANDSON in the EXPLORER is a button that looks like a piece of paper with a plus symbol in its top-left corner. If you hover your mouse over this button for a moment, a popup will appear indicating that this button will create a new file.

Choose File > New File from the app's menu.

Press Control + N in Windows or Command + N on a Mac (the plus means "and at the same time").

Now you are ready to get started on your Lesson 6 Hands-On!

Requirements

This hands-on is broken into two parts. Please complete each part within your main.py file.

Part 1

Create a class named Stadium

Use the init method to include the following three properties:

name

city_state

capacity

Hint! What is the property that is included in every method? Don't forget that one!

Initialize each property/attribute within the init method

Include a docString for the class and method

Create another method within the Stadium class named describe_stadium

The describe_stadium method should utilize each method from the Stadium class which will then print a description of the arena (see step 10 for an example of a description).

Create a new instance of the Stadium class named stadium1.

The stadium1 instance should provide values for each of the three properties of the Stadium class

Finally, stadium1 should call the describe_stadium method.

The output should be similar to the following:

The Mercedes Benz Arena is located in Atlanta, GA and holds 70,000 fans. 

Part 2

Add two more methods to the Stadium class:

sport_played - This method should accept one argument that specifies the sport that is played

seats_available - This method should accept one argument that specifies how many seats are available

Each of the above method should print out a sentence using the argument provided (see step 4 for output)

Using the stadium1 instance, call each of the new methods, providing the relevant arguments. As an example, if the following code to use the class were added:

After running this program in your terminal, the output should be similar to the following:

The Mercedes Benz Arena is in Atlanta, GA and holds 70000 fans. The following sport is mainly played in this stadium: Football There are 15000 seats still available for tonight's game.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!