This error is confusing me. I am wondering if anyone can help me out.

Using W7 64 Ultimate
Using Python 3.1.1


This is the relevant part of the program.


class Player(object):

    def __init__(self):
        print("Player created.")

    def inventory(self):
        self.inventory = ["torch"]
        return self.inventory

player = Player()

print("\nYour current inventory is", end= " ")
print(player.inventory())

print("\nYour current inventory is", end= " ")
print(player.inventory())


The first time the program prints the inventory correctly but when it
does the exact same thing again it throws up an error. I can't think
of a reason for why this happens.

This is the error:

Traceback (most recent call last):
  File "C:\Users\Matthew\Desktop\test.py", line 16, in <module>
    print(player.inventory())
TypeError: 'list' object is not callable


Can anyone help me with this? I'd appreciate it.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to