Python Challenges (Class & Inheritance)

Published: 17 November 2020
on channel: Novuspad
99
3

#python #pythonclasses #Inheritance
In this video we will cover a python challenge, and how to solve it. However these challenges are made to test you, and help build your skills so please try to solve them before watching this video!

Hope this helps solidifies your knowledge on classes, and Inheritance with classes, and hope you enjoy the video!

Twitter:   / bitwizard8  
Discord:   / discord  

Player
Your Player class will need to consist of the following:
Attributes
• name
• health (HP)
• damage
• defense
Functions/Constructors
• init
• characterCreate( ) – prompts the user to input values for each of your attributes and displays
chosen values back to user

Enemy
Enemy will inherit from your Player class. You will need to add/modify the following:
Attribute (new)
• type
Functions/Constructor (Override)
• init
• characterCreate( ) – prompts the user to input values for each of your attributes
The Enemy class should add an extra field called type and will be required to override
the characterCreate( ) method from Player to allow a user to select between three (3) enemy types of
our choosing. Based upon the user's choice the other attributes should be automatically set according to
the type of enemy chosen.


Possible enemy types are Minion, Brawler, and Elite.
When selected:
• Minion stats are automatically set to Health 10, Damage 2, and Defense 1.
• Brawler stats are automatically set to Health 30, Damage 10, and Defense 5.
• Elite stats are automatically set to Health 100, Damage 20, and Defense 20.

Upon runtime, our program should perform the following:
1. Create an instance of the Player class
2. Use the Player object to call its characterCreate() function
3. User will be prompted to enter all appropriate values for the Player’s character creation
4. Create an instance of the Enemy class
5. Use the Enemy object to call its characterCreate() function
6. User will be prompted to enter Enemy name and type. Remaining values will be pre-determined
based on user’s input


Watch video Python Challenges (Class & Inheritance) online without registration, duration hours minute second in high quality. This video was added by user Novuspad 17 November 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 99 once and liked it 3 people.