Question: This question is from the conditions lab so please try answering this question using if statements instead of for loops :) and please describe what
This question is from the "conditions" lab so please try answering this question using if statements instead of for loops :) and please describe what you're doing in the solutions as i've spent ages on this question :(
A list of people's age and gender are provided in two separate lists age_list and name_list, and they are indexed for each person (e.g. person 1's information is at age_list[1] and name_list[1]). Write a function locate_person (age_list, name_list, age, name) which returns the index of the first person that has age equal to age and the name equal to name. You can assume there is always a person that matches the description, and names in the name_list are unique. For example: Test Result print(locate_person([15, 7, 3, 9, 11, 6, 8], ["David", "Tom", "Mary", "Sam", "Harry", "Abby", "Nigel"), 3, "Mary")) 2 print(locate_person([15, 7, 3, 9, 11, 6, 8], ["David", "Tom", "Mary", "Sam", "Harry", "Abby", "Nigel"], 11, "Harry")) 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
