How do I print out a list of objects? - python

I have been trying to get my objects to be printed out as list. The list is the inventory. It should be printed out by typing i. But I only an error that shows there objects in a list that can't be printed. I keep getting an error. Please can you help me?
def play():
while True:
Action_input = get_player_action()
if Action_input in ["n","North"]:
print("Go North")
elif Action_input in ["s","South"]:
print("Go South")
elif Action_input in ["e","East"]:
print("Go East")
elif Action_input in ["w","West"]:
print("Go West")
elif Action_input in ["i","I"]:
print("Inventory")
for i in inventory:
print(inventory)
else:
print("Not an availble direction. Use only n,e,w,s,North,South,East, or West")
class Resources:
def __init__(self):
self.name = name
self.description = description
self.health = health
def __str__(self):
return " Name: " + self.name + "Description: " + str(self.description) + " Damage: " + str(self.damage)
class bread(Resources):
def __init__(self):
self.name = "bread"
self.description = "A kind of food that is cheap and nice."
self.health = 4
class pako(Resources):
def __init__(self):
self.name = "pako"
self.description = "A long piece of wood that can be used as a weapon"
self.damage = 10
class punch(Resources):
def __init__(self):
self.name = "punch"
self.description = "Using the fist to strike"
self.damage = 6
class owo(Resources):
def __init__(self):
self.name = "owo"
self.description = "What you use to buy goods or services"
self.value = 10
def get_player_action():
return input("What is your move?")
def best_attack_move(inventory):
Max_Attack = 0
Best_attack_move = None
for item in inventory:
if item.damage > Max_Attack:
Best_attack_move = item
Max_Attack = item.damage
return Best_attack_move
inventory = [bread(),pako(),punch(),owo()]
play()
Error:
What is your move?i
Inventory
[<main.bread object at 0x02ADC418>, <main.pako object at 0x02ADC448>, <main.punch object at 0x02ADC478>, <main.owo object at 0x02ADC4A8>]
[<main.bread object at 0x02ADC418>, <main.pako object at 0x02ADC448>, <main.punch object at 0x02ADC478>, <main.owo object at 0x02ADC4A8>]
[<main.bread object at 0x02ADC418>, <main.pako object at 0x02ADC448>, <main.punch object at 0x02ADC478>, <main.owo object at 0x02ADC4A8>]
[<main.bread object at 0x02ADC418>, <main.pako object at 0x02ADC448>, <main.punch object at 0x02ADC478>, <main.owo object at 0x02ADC4A8>]
What is your move?

a simple solution to your problem is in for loop.
elif Action_input in ["i","I"]:
print("Inventory")
for i in inventory:
print(i)
Replace inventory by i. also there are few errors as described below.
In bread class
class bread(Resources):
def __init__(self):
self.name = "bread"
self.description = "A kind of food that is cheap and nice."
self.health = 4
replace self.health by self.damage
and same for owo class
class owo(Resources):
def __init__(self):
self.name = "owo"
self.description = "What you use to buy goods or services"
self.damage = 10
replace self.value by above
Your final code should look alike
def play():
while True:
Action_input = get_player_action()
if Action_input in ["n","North"]:
print("Go North")
elif Action_input in ["s","South"]:
print("Go South")
elif Action_input in ["e","East"]:
print("Go East")
elif Action_input in ["w","West"]:
print("Go West")
elif Action_input in ["i","I"]:
print("Inventory")
for i in inventory:
print(i)
else:
print("Not an availble direction. Use only n,e,w,s,North,South,East, or West")
class Resources:
def __init__(self):
self.name = name
self.description = description
self.health = health
def __str__(self):
return " Name: " + self.name + "\n Description: " + str(self.description) + "\n Damage: " + str(self.damage)
class bread(Resources):
def __init__(self):
self.name = "bread"
self.description = "A kind of food that is cheap and nice."
self.damage = 4
class pako(Resources):
def __init__(self):
self.name = "pako"
self.description = "A long piece of wood that can be used as a weapon"
self.damage = 10
class punch(Resources):
def __init__(self):
self.name = "punch"
self.description = "Using the fist to strike"
self.damage = 6
class owo(Resources):
def __init__(self):
self.name = "owo"
self.description = "What you use to buy goods or services"
self.damage = 10
def get_player_action():
return input("What is your move?")
def best_attack_move(inventory):
Max_Attack = 0
Best_attack_move = None
for item in inventory:
if item.damage > Max_Attack:
Best_attack_move = item
Max_Attack = item.damage
return Best_attack_move
inventory = [bread(),pako(),punch(),owo()]
play()

You need to put every instance of the inventory variable inside str(), and also.
inventory = [str(bread()),str(pako()),str(punch()),str(owo())]
(By the way, the bread and owo have no damage attribute, so you will get an error about it)

Related

Python simple hit game (Sololearn goblin game)

I'm new to coding, using sololearn and trying to make some changes to the code in a simple python game to do with injuring a goblin. It takes two words, the first is the verb and there are a few options of what you can do. Then there is the noun, and only class of character here is the goblin.
Two things I am stuck on:
I am wanting to print out the goblin's health and then the comment
(e.g. "Tis but a flesh wound") after each time he is hit.
I was also wanting to add a generic verb that allows for other types of injury; stroke, stab, and have one class that logs that as
a hit too.
Appreciate any feedback
#simple game
class GameObject:
class_name = ""
desc = ""
objects = {}
def __init__(self, name):
self.name = name
GameObject.objects[self.class_name] = self
def get_desc(self):
return self.class_name + "\n" + self.desc
class Goblin(GameObject):
def __init__(self, name):
self.class_name = "goblin"
self.health = 3
self._desc = "A foul creature"
super().__init__(name)
#property
def desc(self):
if self.health >= 3:
return self._desc
elif self.health == 2:
health_line = "Tis but a flesh wound"
elif self.health == 1:
health_line = "He's not looking good"
elif self.health <= 0:
health_line = "It is dead"
return self._desc + "\n" + health_line
#desc.setter
def desc(self, value):
self._desc = value
def hit(noun):
if noun in GameObject.objects:
thing = GameObject.objects[noun]
if type(thing) == Goblin:
thing.health = thing.health -1
print(thing.health)
if thing.health <= 0:
msg = "You killed the Goblin"
else:
msg = "You hit the {}".format(thing.class_name)
else:
msg = "There is no {} here".format(noun)
return msg
goblin = Goblin("Gobbly")
def examine(noun):
if noun in GameObject.objects:
return GameObject.objects[noun].get_desc()
else:
return "What do you mean, there is no {} here".format(noun)
def get_input():
command = input(": ").split()
verb_word = command[0]
if verb_word in verb_dict:
verb = verb_dict[verb_word]
else:
print("Unrecognised verb {}, not in our incredibly limited dictionary".format(verb_word))
return
if len(command) >= 2:
noun_word = command[1]
print(verb(noun_word))
else:
print(verb("Nothing. Nada"))
def say(noun):
return "You said {}".format(noun)
verb_dict = {"say": say,
"examine": examine,
"hit": hit,
# "stab": stab,
# "stroke": stroke
}
while True:
get_input()

__init__() missing 7 required positional arguments

I want to Inheritance my animal class to Dog class.Everything is good until ı want to write Dog.add_info() at operation 1.I wrote Dog = Dog(animal) at line 46 but ı think there are a problem but ı can't find out what it is.I learning 'class' thing and 'Inheritance' thing first.
import random
class animal():
def __init__(self,name,legs,place,move,weight,lenght):
self.name = name
self.legs = legs
self.place = place
self.move = move
self.weight = weight
self.lenght = lenght
def __str__(self):
return "Name: {}\nLegs: {}\nPlace: {}\nMove: {}\nWeight: {}\nLenght: {}".format(self,self.name,self.legs,self.place,self.move,self.weight,self.lenght)
def add_info(self):
info_name = input("Enter name")
info_legs = input("Enter how many legs this animal have")
info_place = input("Enter where this animal live")
info_move = input("Enter how move this animal")
info_weight = input("Enter Weight")
info_lenght =input("Enter lenght")
self.name = info_name
self.legs = info_legs
self.place = info_place
self.move = info_move
self.weight = info_weight
self.lenght = info_lenght
class Dog(animal):
def __init__(self,name,legs,place,move,weight,lenght,feather,aggresivity):
super().__init__(self,name,legs,place,move,weight,lenght)
self.feather = feather
self.aggresivity = aggresivity
def __str__(self):
return "Name: {}\nLegs: {}\nPlace: {}\nMove: {}\nWeight: {}\nLenght: {}\nFeather: {}\nAggresivity {}".format(self, self.name, self.legs,self.place, self.move,self.weight, self.lenght,self.feather,self.aggresivity)
def add_info(self):
super().add_info()
info_feather = input("Enter are your dog have feather or not 'have' or 'haven't")
info_aggresivity =input("Enter are your dog aggresive or passive")
self.feather = info_feather
self.aggresivity = info_aggresivity
def pick_random(self):
list_dog = ["Labrador","Bulldog","Retriever,","Poodle","Beagle","Husky"]
random_dog = random.choice(list_dog)
print("Your dog is :",random_dog)
Dog = Dog(animal)
print("""
1 for add info to your dog
2 for get infos your dog have
3 for pick random dog type
q for quit
""")
choice = input("Enter operation: ")
while True:
if (choice =="q"):
print("BYE...")
break
elif(choice == "1"):
Dog.add_info()
elif(choice =="2"):
pass
elif(choice =="3"):
pass
else:
print("İnvalid operation")
Dog expects all the same arguments as animal; you are passing the class animal itself as a single argument.
Rather than duplicating all the arguments from Animal.__init__, though, use keyword arguments to simplify the definition of Dog.__init__.
First, we'll clean up Animal a little. Note that you were passing self unnecessarily to a lot of methods, as super() already captures the value to pass.
class Animal:
def __init__(self, *, name, legs, place, move, weight, length, **kwargs):
super().__init__(**kwargs)
self.name = name
self.legs = legs
self.place = place
self.move = move
self.weight = weight
self.length = length
def __str__(self):
return "Name: {}\nLegs: {}\nPlace: {}\nMove: {}\nWeight: {}\nLength: {}".format(self.name, self.legs, self.place, self.move, self.weight, self.length)
def add_info(self):
info_name = input("Enter name")
info_legs = input("Enter how many legs this animal have")
info_place = input("Enter where this animal live")
info_move = input("Enter how move this animal")
info_weight = input("Enter Weight")
info_length = input("Enter length")
self.name = info_name
self.legs = info_legs
self.place = info_place
self.move = info_move
self.weight = info_weight
self.length = info_length
Now we define Dog with only the extra arguments; anything intended for the superclass methods will be passed as arbitrary keyword arguments that Dog will pass on.
class Dog(Animal):
def __init__(self, *, feather, aggresivity, **kwargs):
super().__init__(**kwargs)
self.feather = feather
self.aggresivity = aggresivity
def __str__(self):
x = super().__str__()
return x + "\nFeather: {}\nAggresivity {}".format(self.feather, self.aggresivity)
def add_info(self):
super().add_info()
info_feather = input("Enter are your dog have feather or not 'have' or 'haven't")
info_aggresivity =input("Enter are your dog aggresive or passive")
self.feather = info_feather
self.aggresivity = info_aggresivity
def pick_random(self):
list_dog = ["Labrador","Bulldog","Retriever,","Poodle","Beagle","Husky"]
random_dog = random.choice(list_dog)
print("Your dog is :",random_dog)
Finally, we instantiate Dog using keyword arguments.
d = Dog(name="...", legs="...", ...) # etc
When initializing a class, you must provide all of the arguments required by the init method. See this great (and similarly themed) answer which illustrates the right way to initialize a instance:
class Dog:
def __init__(self, legs, colour):
self.legs = legs
self.colour = colour
fido = Dog(4, "brown")
spot = Dog(3, "mostly yellow")
In your case, you need to provide all of the required arguments: name, legs, place, move, weight, length, feather, aggresivity.
If you'd like to write a function which helps a user instantiate an instance, you could create a classmethod:
class Animal:
...
#classmethod
def add_info(cls):
info_name = input("Enter name")
info_legs = input("Enter how many legs this animal have")
info_place = input("Enter where this animal live")
info_move = input("Enter how move this animal")
info_weight = input("Enter Weight")
info_lenght =input("Enter lenght")
return cls(
info_name,
info_legs,
info_place,
info_move,
info_weight,
info_lenght
)
now, calling Animal.add_info() will prompt the user for the correct attributes and then return a properly instantiated object.
This answer is based on the information in my comments above:
import random
class animal():
def __init__(self,name,legs,place,move,weight,length):
self.name = name
self.legs = legs
self.place = place
self.move = move
self.weight = weight
self.length = length
def __str__(self):
return "Name: {}\nLegs: {}\nPlace: {}\nMove: {}\nWeight: {}\nlength: {}".format(self,self.name,self.legs,self.place,self.move,self.weight,self.length)
def add_info(self):
info_name = input("Enter name")
info_legs = input("Enter how many legs this animal have")
info_place = input("Enter where this animal live")
info_move = input("Enter how move this animal")
info_weight = input("Enter Weight")
info_length =input("Enter length")
self.name = info_name
self.legs = info_legs
self.place = info_place
self.move = info_move
self.weight = info_weight
self.length = info_length
class Dog(animal):
def __init__(self, name="sparky", legs=4, place="right here", move=True, \
weight="45 pounds", length="30 inches", feather=False, aggresivity="friendly"):
super().__init__(name, legs, place ,move, weight, length)
self.feather = feather
self.aggresivity = aggresivity
def __str__(self):
return "Name: {}\nLegs: {}\nPlace: {}\nMove: {}\nWeight: {}\nlength: {}\nFeather: {}\nAggresivity {}".format(self, self.name, self.legs,self.place, self.move,self.weight, self.length,self.feather,self.aggresivity)
def add_info(self):
super().add_info()
info_feather = input("Enter are your dog have feather or not 'have' or 'haven't")
info_aggresivity =input("Enter are your dog aggresive or passive")
self.feather = info_feather
self.aggresivity = info_aggresivity
def pick_random(self):
list_dog = ["Labrador","Bulldog","Retriever,","Poodle","Beagle","Husky"]
random_dog = random.choice(list_dog)
print("Your dog is :",random_dog)
Dog = Dog()
print("""
1 for add info to your dog
2 for get infos your dog have
3 for pick random dog type
q for quit
""")
while True:
choice = input("Enter operation: ")
if (choice =="q"):
print("BYE...")
break
elif(choice == "1"):
Dog.add_info()
elif(choice =="2"):
pass
elif(choice =="3"):
pass
else:
print("İnvalid operation")

Python, modifying a blackjack game

I am in need of help with an assignment I have been given.
I have been asked to modify the section below from a blackjack game so that a dealer deals a card to each player and the highest card wins unless there is a draw.
I am unable to get the code right for this.
This is what i have in place:
for player in self.still_playing:
if player.total > self.players.total:
player.win()
elif player.total < self.players.total:
player.lose()
else:
player.push()
here is the rest of the code:
import Cards, Games
class BJ_Card(Cards.Card):
# Defines a Blackjack card
ACE_VALUE = 1
#property
def value(self):
if self.is_face_up:
val = BJ_Card.CARDS.index(self.card) + 1
if val > 10:
val = 10
else:
val = None
return val
# This object returns a number between 1 and 10,
# representing the value of a Blackjack card
class BJ_Deck(Cards.Deck):
# Defines a Blackjack deck
def populate(self):
for suit in BJ_Card.SUITS:
for card in BJ_Card.CARDS:
self.cards.append(BJ_Card(card, suit))
class BJ_Hand(Cards.Hand):
# Defines a Blackjack hand
def __init__(self, name):
super(BJ_Hand, self).__init__()
self.name = name
def __str__(self):
rep = self.name + ":\t" + super(BJ_Hand, self).__str__()
if self.total:
rep += "(" + str(self.total) + ")"
return rep
#property
def total(self):
# If a card has the value None, then total is None
for card in self.cards:
if not card.value:
return None
# Add card values
t = 0
for card in self.cards:
t += card.value
# Check if hand contains an Ace
contains_ace = False
for card in self.cards:
if card.value == BJ_Card.ACE_VALUE:
contains_ace = True
# treat Ace as 1
contains_ace = 1
return t
def is_busted(self):
return self.total > 21
class BJ_Player(BJ_Hand):
# Defines a Blackjack player
def is_hitting(self):
response = Games.askYesNo("\n" + self.name + ", do you want another
card? (Y/N): ")
return response == "y"
def bust(self):
print(self.name, "busts.")
self.lose()
def lose(self):
print(self.name, "loses.")
def win(self):
print(self.name, "wins.")
def push(self):
print(self.name, "draws.")
class BJ_Dealer(BJ_Hand):
# Defines a Blackjack dealer
def is_hitting(self):
return self.total < 17
def bust(self):
print(self.name, "busts.")
def flip_first_card(self):
first_card = self.cards[0]
first_card.flip()
class BJ_Game(object):
# Defines a Blackjack game
def __init__(self, names):
self.players = []
for name in names:
player = BJ_Player(name)
self.players.append(player)
self.dealer = BJ_Dealer("Dealer")
self.deck = BJ_Deck()
self.deck.populate()
self.deck.shuffle()
#property
def still_playing(self):
sp = []
for player in self.players:
if not player.is_busted():
sp.append(player)
return sp
def __additional_cards(self, player):
while not player.is_busted() and player.is_hitting():
self.deck.deal([player])
print(player)
if player.is_busted():
player.bust()
def play(self):
# Deal initial 1 card to all players
self.deck.deal(self.players, per_hand = 1)
for player in self.players:
print(player)
for player in self.still_playing:
if player.total > self.players.total:
player.win()
elif player.total < self.players.total:
player.lose()
else:
player.push()
# Remove everyone's cards
for player in self.players:
player.clear()
def main():
print("\nWelcome to the Python Blackjack game.\n")
names = []
number = Games.askForNumber("How many players? (2-7): ", low = 2, high =
8)
print()
i = 1
for i in range(number):
name = input("Enter player name: ")
if name == "":
names.append("Anon")
print()
i += 1
else:
names.append(name)
print()
i += 1
game = BJ_Game(names)
again = "Y"
while again == "y" or again == "Y":
game.play()
again = Games.askYesNo("\nDo you want to play again?: ")
main()
self.players
is a list of BJ_Player classes / objects. You're calling self.players.total i.e trying to get the property total of a python list which does not exist as this is not a property of a list. I assume you're trying to do something more like;
for player in self.players:
print(player.total)
this way you would be accessing each players total. However, the class BJ_Player does not appear to have a total property either, so you will need to add this to the class and then use a loop like the one given above.

Type Error : 'str' object is not callable (Python)

I'm relatively new to python and I've been trying to practice OOP in python with this example:
def get_input():
command = input(':').split()
verb_word = command[0]
if verb_word in verb_dict:
verb = verb_dict[verb_word]
else:
print('Unkown verb "{}"'.format(verb_word))
return
if len(command) >= 2:
noun_word = command[1]
print(verb(noun_word))
else :
print(verb('nothing'))
def say(noun):
return "You said '{}'".format(noun)
class GameObject:
class_name = ""
_desc = ""
health_line = ""
objects = {}
def __init__(self,name):
self.name = name
GameObject.objects[self.class_name] = self
def desc(self):
return self.class_name + "\n" + self._desc + "\n" + self.health_line
class Goblin(GameObject):
def __init__(self,name):
self.class_name = "goblin"
self.health = 3
self._desc = 'A foul creature'
super().__init__(name)
#property
def desc(self):
if self.health >= 3:
return self._desc
elif self.health == 2:
health_line = 'It is badly bruised'
elif self.health == 1:
health_line = 'It is barely standing'
elif self.health <= 0:
health_line = 'It is dead'
return self._desc +'\n'+ self.health_line
#desc.setter
def desce(self,value):
self.__desc = value
goblin = Goblin("Gobbly")
def hit(noun):
if noun in GameObject.objects:
thing = GameObject.objects[noun]
if type(thing) == Goblin:
thing.health = thing.health - 1
if thing.health <= 0:
msg = "You killed it"
else:
msg = "You hit the {}".format(thing.class_name)
else:
msg = "There is no {} here".format(noun)
return msg
def examine(noun):
if noun in GameObject.objects:
return GameObject.objects[noun].desc()
else:
return "There is no '{}' here".format(noun)
verb_dict ={"say":say,"examine":examine,"hit":hit}
while True :
get_input()
It seems that this line:
return GameObject.objects[noun].des()
returns the Type Error. I'm not sure why this is, and I've been at this for a while. Any help is much appreciated.
If you want to call the desc function, you will have to do it as such:
GameObject.desc(parameter)
where the parameter can be object[noun]. This is because the desc method belongs to the GameObject class.

Inheritance issue I don't understand

I'm a beginner and stumbled across an issue with inheritance.
When I use this block of code, the program doesn't work correctly thanks to a line in the enter function:
class Bathroom(Room):
def __init__(self):
super(Bathroom, self).__init__("bathroom")
def enter(self, world, player):
super(Bathroom, self).enter(world, player)
But, when I use this, it does:
class Bathroom(Room):
def __init__(self):
super(Bathroom, self).__init__("bathroom")
Are they not the same thing?
The full script I've written (not finished btw) is below. When I enter 'y' after being asked 'Do you want to leave', the program finishes when I use 'super' to inherit the enter function. If I don't, the program works:
while player and self.name != "corridor":
response = self._ask_question("Do you want to leave? (y/n) ", "y", "n")
if response == "y":
return world.corridor
elif response == "n" and self.enemy:
print("The", self.enemy, "kills you. You didn't even put up a\
fight")
return world.death
Full script:
import random
import time
# bad from sys import exit
class Character(object):
def __init__(self, name, health, attack):
self.name = name
self.health = health
self.attack = attack
def __str__(self):
return str(self.health) + " health and " + str(self.attack) + " attack."
class Room(object):
def __init__(self, name):
self.name = name
self.enemy = self._getRandEnemy()
def enter(self, world, player):
print(player.name + ",", "you are in the", self.name + ". You have\
" + str(player))
if self.enemy: # you may have killed it
print("But, wait! There's a", self.enemy.name, "with " + str(\
self.enemy))
response = self._ask_question("Do you stay and fight?(y/n)\
", "n", "y")
if response == "n":
pass
if response == "y":
self.combat(player, self.enemy)
else:
print("No enemies here.")
# check if player has no health after potential fight
if player.health < 1:
return world.death
while player and self.name != "corridor":
response = self._ask_question("Do you want to leave? (y/n) ", "y", "n")
if response == "y":
return world.corridor
elif response == "n" and self.enemy:
print("The", self.enemy, "kills you. You didn't even put up a\
fight")
return world.death
def _getRandEnemy(self):
names = ["Troll", "Witch", "Ogre", "Jeremy Corbyn"]
return Character(random.choice(names), random.randint(4, 6),\
random.randint(2, 3))
def _ask_question(self, question, a, b):
response = None
while response not in(a, b):
response = input(question)
return response
def combat(self, player, enemy):
while player.health > 0 and enemy.health > 0:
time.sleep(1)
print("You attack and deal", player.attack, "damage")
enemy.health -= player.attack
if enemy.health >= 1:
print("The enemy has " + str(self.enemy))
time.sleep(1)
print("The", self.enemy.name, "attacks and deals you",\
self.enemy.attack, "\
damage.")
player.health -= enemy.attack
print("You have " + str(player))
if player.health < 1:
pass
if enemy.health < 1:
print("Ha! Got him!")
self.enemy = None
class Corridor(Room):
def __init__(self):
self.name = "corridor"
self.enemy = None
def enter(self, world, player):
super(Corridor, self).enter(world, player)
room = self._ask_question("Which room: bathroom, bedroom ",\
"bedroom", "bathroom", "Library", "study")
if room == "bedroom":
return world.bedroom
if room == "bathroom":
return world.bathroom
class Bathroom(Room):
def __init__(self):
super(Bathroom, self).__init__("bathroom")
def enter(self, world, player):
super(Bathroom, self).enter(world, player)
class Bedroom(Room):
def __init__(self):
super(Bedroom, self).__init__("bedroom")
class Death(Room):
def __init__(self):
super(Death, self).__init__("death")
def enter(self, world, player):
time.sleep(1)
responses = ["Off to the man in sky. You are dead", "You died,\
no-one cried.", "Lolz. You're dead!"]
print(random.choice(responses))
return None
class World(object):
def __init__(self):
self.corridor = Corridor()
self.bathroom = Bathroom()
self.death = Death()
self.bedroom = Bedroom()
self.start = self.corridor
def play_game(world, player):
room = world.start
while room:
room = room.enter(world, player)
play_game(World(), Character("Bob", 12, 2))
I know I must be missing something obvious.
Thanks, Dave.
You forgot to return the result of the super().enter() call. You are swallowing the return value, so you never returned the new room. The following would be correct:
class Bathroom(Room):
def enter(self, world, player):
return super(Bathroom, self).enter(world, player)
Not that there is a point in defining a new Bathroom().enter() method if all you do is call the original version with super(). You may as well remove the whole enter() method (as I've done for the __init__ method, above).

Categories

Resources