Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
20-liner: HumanoRobotic Dialogues Have been Achieved Successfully solution in Clear category for Dialogues by Stensen
from dataclasses import dataclass
@dataclass
class Chat:
human_dialogue, robot_dialogue = [], []
def connect_human(self, human): human.medium = self
def connect_robot(self, robot): robot.medium = self
show_human_dialogue = lambda self: '\n'.join(self.human_dialogue)
show_robot_dialogue = lambda self: '\n'.join(self.robot_dialogue)
@dataclass
class Human:
name: str
def send(self, msg):
self.medium.robot_dialogue.append(f'{self.name} said: {"".join(["10"[k in "AEIOUaeiou"] for k in msg])}')
self.medium.human_dialogue.append(f'{self.name} said: {msg}')
@dataclass
class Robot:
snum: str
def send(self, msg):
self.medium.human_dialogue.append(f'{self.snum} said: {msg}')
self.medium.robot_dialogue.append(f'{self.snum} said: {"".join(["10"[k in "AEIOUaeiou"] for k in msg])}')
Oct. 14, 2020