jeudi 12 mars 2020

So i am trying to match a number and a name.Can you explain the meaning of this symbol in this code? The question is inside the comments

my_array=[1,2,3]

my_array1=['John','Tom','Peter']

search=int(input("Enter your number"))

for i in range(0,3):
    if search==my_array[i]: ### can you please point out the purpose of this '[i]' ? what does it do? 
            print(my_array1[i]) ### also this one 

Aucun commentaire:

Enregistrer un commentaire