Untitled
unknown
plain_text
a year ago
1.5 kB
14
Indexable
#Homework solution
names=['ahmed','mohamed','heba','lugain','adam']
for i in range(3):
print(names[i])
#Find Minimal value of list
def findcheapest(prices):
min = 99999999
for t in prices :
if t<min:
min =t
print(min)
prices = [12,6,5,20,18,23,2]
findcheapest(prices)
#Find Maxmimum value of list
def findmaximum(prices):
max = -99999999
for t in prices :
if t>max:
max =t
print(max)
prices = [12,6,5,20,18,23,2]
findmaximum(prices)
# 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 don't 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 'Ai Branches'
Editor is loading...
Leave a Comment