I am trying to display some information about an object, including the name, but instead, it is displaying a weird string. I am pretty new to python, and I have just started working with classes.
This is the code I wrote:
class Test:
def __init__(name,item):
name.item = item
def display(name):
print(f"Name: {name}\nItem: {name.item}")
testname = Test("test")
testname.display()
And I got:
Name: <__main__.Test object at 0x7f76f0733f10>
Item: test
instead of:
Name: testname
Item: test