Jan-07-2018, 05:59 AM
The code below models a simple game that tests if an input occurs in the list. The function is called twice, then the total # of correct answers is printed.
Thanks!
foot_bones = ["calcaneus", "talus", "cuboid", "navicular", "lateral cuneiform", "intermediate cuneiform", "medial cuneiform"] answers_right = 0 def finder(bone_name): if bone_name.lower() in foot_bones: print("correct!") answers_right += + 1 else: print("incorrect") finder(input("enter name of a bone: ")) finder(input("enter name of another bone: ")) print("number of foot bones correctly identified: ", answers_right)Code returns no error when the input is "incorrect", but gives an UnboundLocalError when a correct one is passed. How do I fix it? Simple issue.
Thanks!