Untitled
unknown
plain_text
a year ago
1.2 kB
6
Indexable
#homework solution names = ['ahmed','mohamed', 'ali', 'yassin', 'tamer', 'lily' ] for i in range (3) : print(names[i]) #find minimal number numbers = [12,6,5,20,18,23,2] min=999999999 for i in numbers: if i<min: min=i print(min) #find maximum number numbers = [12,6,5,20,18,23,2] max=-999999999 for i in numbers: if i>max: max=i print(max) #Codes Ai chatting partner from mblock import event questions = ['Hello','What is your name','How are you'] answers = ['hi','My name is pico','Iam fine, Thanks'] @event.greenflag def on_greenflag(): while True: answer = sprite.input('Say something') if sprite.answer in questions : print('found') j=0 while not questions[j]==sprite.answer: j=j+1 sprite.say(answers[j],2) else: newQuestion=answer sprite.say('I Can not understand!',2) answer = sprite.input('Could you teach me?') if sprite.answer == 'yes': questions.append(newQuestion) answer= sprite.input(str('What does ')+ str(newQuestion)+str(' Mean?')) answers.append(answer) #Homework search about 2 Ai branches
Editor is loading...
Leave a Comment