I'm learning Python and I'm trying to enter the worker's name and last name separately through the input but then save it in the list as one "element" or "object"(not sure how it is called.
So it would be something like this:
name1 = input("Enter the name: John ")
lastname1 = input("Enter the last name: Conor ")
name2 = input("Enter the name: Michael ")
lastname2 = input("Enter the last name: Scott ")
Result: list = [John Conor, Michael Scott]
This is what I got so far, I googled as much as I could but I just cannot find any example of what I need:
class Worker:
def __init__(self, name, lastname):
self.name = name
self.lastname = lastname
def name_lastname(self):
print(self.name, self.name)
class Project:
def __init__(self, name, worker):
self.name = name
self.worker = worker
list = []
name1 = input("Enter the name: ")
lastname1 = input("Enter the last name: ")
name2 = input("Enter the name: ")
lastname2 = input("Enter the last name: ")