def Elaborate(self, request, context): e = request.topic ans = "" if not request.blah_run: return debate_pb2.ElaborateReply(answer=e) for n in request.blah_run: ans += n * "blah " ans += e + " " return debate_pb2.ElaborateReply(answer=ans)
def Elaborate(self, request, context): topic = request.topic blah_run = request.blah_run if len(blah_run) == 0: return debate_pb2.ElaborateReply(answer=topic) answer = [] if len(blah_run) == 1: answer += ["blah"] * blah_run[0] answer += [topic] else: for count in blah_run[:-1]: answer += ["blah"] * count answer += [topic] answer += ["blah"] * blah_run[-1] return debate_pb2.ElaborateReply(answer=" ".join(answer))
def Elaborate(self, request, context): if len(request.blah_run) is 0: return debate_pb2.ElaborateReply(answer=request.topic.lower()) else: return_string = '' if len(request.blah_run) is 1: return_string += ('blah ' * request.blah_run[0]) + request.topic.lower() else: for i in range(0, len(request.blah_run)): if i is len(request.blah_run) - 1: return_string += ('blah ' * request.blah_run[i]) else: return_string += ('blah ' * request.blah_run[i] ) + request.topic.lower() + ' ' return debate_pb2.ElaborateReply(answer=return_string)
def Elaborate(self, request, context): topic = request.topic blah_run = request.blah_run output = "" if len(blah_run) == 0: output = topic else: for i in blah_run: output += "blah " * i + topic + " " return debate_pb2.ElaborateReply(answer=output)
def Elaborate(self,request,context): answer = "" topic = request.topic blah = request.blah_run #blah_run is empty if len(blah) == 0: answer = topic elif len(blah) == 1: answer = 'blah ' * blah[0] + topic else: for i in range(len(blah)-1): answer += " blah " * blah[i] + topic answer += " blah " * blah[-1] return debate_pb2.ElaborateReply(answer=answer)
def Elaborate(self, request, context): # response has repeated runs of the word 'blah' separated by 'topic' # the length of each 'blah' run corresponds to a value of 'blah_run', in the order it appears # if there is a single run, 'topic' is printed after it # when there are no runs, only 'topic' is printed runs = request.blah_run topic = request.topic response = '' if len(runs) == 0: response = topic elif len(runs) == 1: response = 'blah ' + topic else: for (index, run) in enumerate(runs): response += ('blah ' * run) if index < len(runs) - 1: response += topic + ' ' return debate_pb2.ElaborateReply(answer=response)