im trying to make it so the code prints out the random roles and the random name but when i run the code it gives <main.players object at 0x7f7b87db0bb0> get the <main.items object at 0x7f7b87dbf3d0> this response
i tried to add .name to the print but it would say that they have no attributes i want it to print out the random item and roles name
import random
class players:
def __init__ (self, role, inkey):
self.name = role
self.key=inkey
class items:
def __init__ (self, name):
self.itemname = name
self.owner=""
Roles=[["Hacker","Q"],["Lookout","P"],["Money Man","Z"],["Explosive expert","M"]]
objectroles=[]
for i in Roles:
object1 = players(i[0],i[1])
objectroles.append(object1)
Items=["Goggles","Headset","Torch","Explosives","Map","Laptop","Gloves","Drill"]
objectitems = []
for i in Items:
object2 = items(i)
objectitems.append(object2)
templist=[]
def get():
global templist
item1=random.choice(objectitems)
role1=random.choice(objectroles)
print(role1,"get the", item1)
templist.append(item1)
get()
def take():
global templist
item1=random.choice(objectitems)
role1=random.choice(objectroles)
print(role1,"take the", item1)
templist.append(item1)
take()