I am looking for a way to print the two functions 1) introduce_itself (class Robot) and 2) give_command (class Command_from_Human) using the class use_robot.
However, my terminal in Visual Studio Code prints out the functions in a messy way and gives me a <main.use_robot object at 0x000001D037423F40>. Is there a solution to this error?
class Robot():
def __init__(self, nam, weight, production_year):
self.nam = nam
self.weight = weight
self.production_year = production_year
def introduce_itself(self):
print("The name of this robot is " + self.nam)
print("The weight of my robot " + self.weight + " kg")
print("This robot is produced in " + str(self.production_year))
class Commands_from_Human():
def __init__(self, name, style, is_sitting):
self.name = name
self.style = style
self.is_sitting = is_sitting
def sit(self):
self.is_sitting = True
def standup(self):
self.is_sitting = False
def give_command(self):
if self.is_sitting == True:
print("My name is " + self.name + "." + " I am your owner.")
print("My style of usage is " + self.style)
print("Robot, sit!")
if self.is_sitting == False:
print("My name is " + self.name + "." + " I am your owner.")
print("My style of usage is " + self.style)
print("Robot, stand!")
class use_robot(Robot, Commands_from_Human):
def __init__(self, nam, weight, production_year, name, style, is_sitting):
Robot. __init__(self, nam, weight, production_year)
Robot. introduce_itself(self)
Commands_from_Human. __init__(self, name, style, is_sitting)
Commands_from_Human. give_command(self)
trial_1 = use_robot("Simon", "100", 2000, "Paul", "Lazy", True)
print(trial_1)