today I am having an issue with using the value of a variable for making the variable name of a class, so say if we do
class human():
def __init__ (self, name="unknown", age="unknown")
self.name=name
self.age=age
def sethuman():
x = input("Enter Name: ")
x = human()
BUT this overwrites the VARIABLE x and sets x to be an object (which will have attributes, etc) when i want the input FROM x (the name entered) to be said object, so instead of using say, "x.name", I wanna say (if the inputted name is John) then "John.name"
Another issue is also if I have a class and there is an object from this class (say John = human("John",27) then how could I later use this in code, as I have no idea how to get this name back later short of putting all of the objects' names into an array and letting the user type which user they wanna edit or look at the attributes of
So if:
def humanhasbeenset():
John=human("John",27)
def printhuman():
# ↓Should be "John"
print(<object name>.name)
Then how would I get the object's name? or a list of object names for that class?