Nov-28-2018, 09:23 PM
Quote:Program: Foot Bones Quiz
Create a function that will iterate through foot_bones looking for a match of a string argument
Call the function 2 times with the name of a footbone
print immediate feedback for each answer (correct - incorrect)
print the total # of foot_bones identified
The program will use the foot_bones list:
foot_bones = ["calcaneus", "talus", "cuboid", "navicular", "lateral cuneiform",
"intermediate cuneiform", "medial cuneiform"]
Bonus: remove correct response item from list if correct so user cannot answer same item twice
Ciao,
I can't uderstand why the code below don't print the identified value correctly.
As far as I understand "identified = 0" inizialize the variable and when the correct bone is inserted "identified += 1" should count +1 ... but the last line "print(identified)" result always 0
thanks
# [ ] Complete Foot Bones Quiz foot_bones = ["calcaneus", "talus", "cuboid", "navicular", "lateral cuneiform", "intermediate cuneiform", "medial cuneiform"] def quiz(): identified = 0 for i in range(2): footbone = input("osso del piede: ") if footbone in foot_bones: print('correct') identified += 1 foot_bones.remove(footbone) else: print("not found") quiz() print(foot_bones) print(identified)