It's time for the opening quidditch match of the season! We represent the various positions for players with the QuidditchPlayer class and its subclasses. Every player begins with a base_energy level, but every position requires a different proportion of energy. Fill in the energy method for the Beater, Chaser, Seeker, and Keeper classes, according to their docstrings. In addition, fill in the__init_ method for the Chaser class. class Beater (QuidditchPlayer): role="bludgers" def energy (self, time): HOH Returns the amount of energy left after playing for time minutes. After playing for time minutes, Beaters lose their base energy level divided by the number of minutes. If time is 0, catch the ZeroDivisionError and print "You can't divide by zero!" instead. >>> fred = Beater ("Fred Weasley", 640) >>> fred.energy (40) 624.0 >>> fred.energy (0) You can't divide by zero! mun "** YOUR CODE HERE ****" Use OK to test your code: python3 ok -q Beater.energy class Chaser (QuidditchPlayer): role = "score" energy_expended = 20 definit_(self, name, base_energy, goals): Chasers have a name, score goals, and begin with base_energy. BITH nun " YOUR CODE HERE *****" def energy (self, time): www Returns the amount of energy left after playing for time minutes. For every goal they score, they use energy_expended units of energy. In addition, they also use 10% of energy_expended if the number of minutes they have played is a multiple of 9. >>> katie = Chaser("Katie Bell", 230, 2) >>> katie.energy (20) 190 >>> ginny = Chaser ("Ginny Weasley", 400, 3) >>> ginny.energy (45) 338.0 HOH "***** YOUR CODE HERE *****" Use OK to test your code: python3 ok -q Chaser.energy class Seeker (QuidditchPlayer): role = "snitch" energy_expended = 5 def energy (self, time): 101 Returns the amount of energy after time minutes. Seekers expend energy_expended units of their energy for every minute they have been playing. >>> harry = Seeker("Harry Potter", 700) >>> harry.energy(30) 550 >>> harry.energy(20) 600 BUH " YOUR CODE HERE ook"
It's time for the opening quidditch match of the season! We represent the various positions for players with the QuidditchPlayer class and its subclasses. Every player begins with a base_energy level, but every position requires a different proportion of energy. Fill in the energy method for the Beater, Chaser, Seeker, and Keeper classes, according to their docstrings. In addition, fill in the__init_ method for the Chaser class. class Beater (QuidditchPlayer): role="bludgers" def energy (self, time): HOH Returns the amount of energy left after playing for time minutes. After playing for time minutes, Beaters lose their base energy level divided by the number of minutes. If time is 0, catch the ZeroDivisionError and print "You can't divide by zero!" instead. >>> fred = Beater ("Fred Weasley", 640) >>> fred.energy (40) 624.0 >>> fred.energy (0) You can't divide by zero! mun "** YOUR CODE HERE ****" Use OK to test your code: python3 ok -q Beater.energy class Chaser (QuidditchPlayer): role = "score" energy_expended = 20 definit_(self, name, base_energy, goals): Chasers have a name, score goals, and begin with base_energy. BITH nun " YOUR CODE HERE *****" def energy (self, time): www Returns the amount of energy left after playing for time minutes. For every goal they score, they use energy_expended units of energy. In addition, they also use 10% of energy_expended if the number of minutes they have played is a multiple of 9. >>> katie = Chaser("Katie Bell", 230, 2) >>> katie.energy (20) 190 >>> ginny = Chaser ("Ginny Weasley", 400, 3) >>> ginny.energy (45) 338.0 HOH "***** YOUR CODE HERE *****" Use OK to test your code: python3 ok -q Chaser.energy class Seeker (QuidditchPlayer): role = "snitch" energy_expended = 5 def energy (self, time): 101 Returns the amount of energy after time minutes. Seekers expend energy_expended units of their energy for every minute they have been playing. >>> harry = Seeker("Harry Potter", 700) >>> harry.energy(30) 550 >>> harry.energy(20) 600 BUH " YOUR CODE HERE ook"
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education