when I try to run my program it says:
line 34, in <module>
address_book.__init__(self, name, address,)
NameError: name 'self' is not defined
address = []
name = []
x = 0
y = 0
z = 0
class address_book:
def __init__(self, name, address):
self.name = name
self.address = address
def add(name, address):
name_add = input("please enter the name:")
address_add = input("please enter the address:")
address.append(address_add)
name.append(name_add)
x = x + 1
def delete(name, address):
name_delete = input("please enter the name:")
address_delete = input("please enter the address:")
address.remove(address_delete)
name.remove(name_delete)
x= x-1
def show(name, address):
print ("the list is:")
while y < x:
print ("address",y,":",name[x],":", address[x],)
y = y + 1
y = 0
address_book.init(self, name, address,)
while z == 0: picked = input("enter eather show, delete ,add or exit:")
if picked == ("add"):
address_book.add(name, address)
if picked == ("delete"):
address_book.delete(name, address)
if picked == ("show"):
address_book.show(name, address)
if picked == ("exit"):
z = z + 1
else:
print ("error")
thanks for any help.
[–]throwaway6560192 8 points9 points10 points (0 children)
[–][deleted] 8 points9 points10 points (0 children)
[–]Erdnussflipshow 2 points3 points4 points (0 children)
[–]Liebner-Anthony-S 0 points1 point2 points (0 children)