Untitled

mail@pastecode.io avatar
unknown
plain_text
5 days ago
949 B
14
Indexable
Never
#Homework(solution)
student = 60
if student>50:
    print('succeed')
else :
    print('unsucceed')   


#print index in list
names = ['ahmed','mohamed','ibrahem']
print(names[2])

#print all list index
names = ['ahmed','mohamed','ibrahem']
for i in range(3):
    print(names[i])

#print all list index
names = ['ahmed','mohamed','ibrahem']
i=0
while i<3:
    print(names[i])
    i+=1
    
#Ai Chat 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)
# create an list that contains 6 names and print only 3 names using index 
Leave a Comment