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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started