Practice 4.2 of intermediate python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Practice 4.2 of intermediate python

Could you help me to fix this could for the practice? The last test of it said it's wrong but it doesn't show

12th Aug 2022, 8:54 AM
Mahdiye Rahimnavaz
Mahdiye Rahimnavaz - avatar
4 Answers
0
Mahdiye Rahimnavaz Check spelling of 'found'
12th Aug 2022, 9:15 AM
A͢J
A͢J - avatar
+ 1
Don't post multiple time and where is your code?
12th Aug 2022, 9:06 AM
A͢J
A͢J - avatar
+ 1
Oh sorry I fix it this is my code: contacts = [ ('James', 42), ('Amy', 24), ('John', 31), ('Amanda', 63), ('Bob', 18) ] name = input() num = 0 for i in range(len(contacts)): if name != contacts[i][0]: num += 1 else: break if num < 5: print (name +" is "+str(contacts[num][1])) else: print ("Not found")
12th Aug 2022, 9:07 AM
Mahdiye Rahimnavaz
Mahdiye Rahimnavaz - avatar
+ 1
OH It was F Tnx
12th Aug 2022, 9:18 AM
Mahdiye Rahimnavaz
Mahdiye Rahimnavaz - avatar