Question: hey brother, i wanna the code without changing any thing in the test code file please help me Dear student, you woke up in a

hey brother, i wanna the code without changing any thing in the test code file please help me

Dear student, you woke up in a mystical and magical world. You feel a strange power flowing through the veins. You are a Planeswalker! You are now able to control mana and creatures, and since you are a good Python programmer, you decide to write a Python class that helps you in managing duels in the Magic the Gathering world. In this first exercise, you need to create 4 classes in order to manage the different types of cards.

The first class, namely the base class for cards, has to be named Card, and it must contain the following attributes: - Name of the card --> name, a string - Tap Status --> isTapped, boolean - Type of the card --> card_type, a string

The second class, namely the card that gives mana to a PlanesWalker, is called ManaCard, and inherits attributes and methods from the Card. In addition to the latter, it has the following attributes: - Card type --> card_type = 'mana', a string - How much mana the card gives to the planeswalker --> mana_qty, a integer number

The third class, namely the class that contains creatures data, must be called Creature, and also this class inherits attributes and methods from the Card. In addition to the latter, it has the following attributes: - Card type --> card_type = 'creature', a string - Mana cost to be casted --> mana_cost, an integer number - Attack Value --> attack, an integer number - Defense Value --> defense, an integer number

The last class is the Planeswalker class. It has to be named PlanesWalker, and it contains the following attributes: - Name of the PlanesWalker --> name, a string - Mana cards list --> mana, a list of mana cards - Creatures card list --> creatures, a list of creatures card - Quantity of mana available --> mana_qty, an integer number. This attribute is NOT PASSED AS ARGUMENT, and ITS DEFAULT VALUE IS 0.

Be sure to create a correct __init__ function for each of the classes and to correctly inherits data from the base class (if necessary).

'''

import mtg

if __name__ == "__main__": pass

# test file >> ''' Test for Exercise 1 ''' from mtg import Card, ManaCard, Creature, PlanesWalker

points = 0

# Instances creation card = Card() mana = ManaCard() creature = Creature() planeswalker = PlanesWalker()

# Test 1 try: if (mana.card_type == 'mana') and ('mana_qty' in mana.__dict__) and ('name' in mana.__dict__) and ('name' in card.__dict__): points += 3 else: print('Test 1 Failed') except Exception as e: print('Test 1 Failed')

# Test 2 try: if ('attack' in creature.__dict__) and ('defense' in creature.__dict__) and (creature.card_type == 'creature'): points += 3 else: print('Test 2 Failed') except Exception as e: print('Test 2 Failed')

# Test 3 try: if (planeswalker.mana_qty == 0) and ('mana' in planeswalker.__dict__) and ('creatures' in planeswalker.__dict__): points += 3 else: print('Test 3 Failed') except Exception as e: print('Test 3 Failed')

print(f'You got {points}/9 points')

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!