Page 1 of 1

Check Career Function Name: checkCareer() Parameters: students ( list ), career (str) Returns: selectedStudents (list) D

Posted: Sat Feb 19, 2022 3:20 pm
by answerhappygod
Check Career Function Name Checkcareer Parameters Students List Career Str Returns Selectedstudents List D 1
Check Career Function Name Checkcareer Parameters Students List Career Str Returns Selectedstudents List D 1 (92.4 KiB) Viewed 33 times
Check Career Function Name: checkCareer() Parameters: students ( list ), career (str) Returns: selectedStudents (list) Description: McGonagall wants to see which of her fifth years want to do a certain job. Write a function that takes in a possible career path and a list of sublists. Each sublist will contain the stu- dent's name, and their desired career. The function should return a list of all the students that have the same desired career as the inputted career path. The list should contain the names in alpha- betical order. Hint: The.sort() method and sorted() function may be helpful in this question. >>> students = [["Harry", "Auror"], ["Ron", "Auror"], ["Seamus", "Curse Breaker"]] >>> checkCareer(students, 'Auror') ['Harry', 'Ron'] >>> students = [["Ginny", "Quidditch Player"], "Luna", "Professor"], ["Padma", "Professor"]] >>> checkCareer(students, 'Quidditch Player') ['Ginny']