Question: python In the third exercise we make one final adjustment to the class by adding initialization data and a docstring. First add a docstring Player-class:

python

In the third exercise we make one final adjustment to the class by adding initialization data and a docstring. First add a docstring "Player-class: stores data on team colors and points.". After this, add an initializing method __init__ to the class, and make it prompt the user for a new player color with the message"What color do I get?: ".

Edit the main function to first create two player objects from the class, player1 and player2. After this, make the program call player1's method "goal" twice and player2's goal once. After this, call both objects with the method "tellscore". If everything went correctly, the program should print something like this:

>>> What color do I get?: Blue What color do I get?: Red I am Blue, we have 2 points! I am Red, we have 1 points! >>> 

Example output:

What color do I get?: Black

What color do I get?: White

I am Black, we have 2 points!

I am White, we have 1 points!

The verification of program output does not account for whitespace and is not case-sensitive (the least strict comparison level)

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!