This question has been answered

I found this description best to learn something new about lists,

please code it according to instruction and add comments so i can learn
Thanks in advance

use a list to represent a student using the following format:
[first_name, last_name, id, sex/gender, major]
For example: ['Giulia', 'Alberini', 123456789, 'F', 'Computer Science'].
Code a function called get_first_names that takes as input a list that has elements like the one above (i.e. the input is a list of lists), as well as a string representing the sex/gender (either 'F', 'M', or 'X' for nonbinary) to search for. The function should first perform some input validation and raise a ValueError if either the input list is not in the correct format (it's enough to check the number of elements of the sublists and their type) or if the string is not one of the supported sex/gender. If the inputs are valid, then the function returns a list containing all the first names of the students with the indicated sex/gender majoring in Computer Science. consider all the following as possible sex/gender entries in the student data:
•    For male: M, man, male, H, homme
•    For female: F, woman, female, femme
•    For nonbinary identities: X, nonbinary, genderqueer, or any other entry. You can check out here a list of the more common nonbinary identities:
nonbinary_identities For example:
>>> students = [['Giulia', 'Alberini', 123456789, 'F', 'Computer Science'],
['Philipp', 'Meyer', 246808642, 'M', 'Neuroscience']
['Bianca', 'Gomes Costa', 135797531, 'female', 'Mathematics']
['Shen', 'Tang', 987654321, 'Homme', 'English Literature']
['Kaiya', 'Estes', 123459876, 'X', 'Computer Science']
['Mhret', 'Sayid', 567894321, 'woman', 'Computer Science']
['Yuna', 'Selezneva',987651234, 'nonbinary', 'Chemical Engineering']]
>>> get_first_names(students, 'F')
['Giulia', 'Mhret']

Answered by Expert Tutors
Step-by-step explanation
The student who asked this found it Helpful
Overall rating 100%
[first_name, last_name, id, sex/gender, major] For example: ['Giulia', 'Alberini', 123456789, 'F', 'Computer Science']. Code a function called...
Get unstuck

204,222 students got unstuck by Course
Hero in the last week

step by step solutions

Our Expert Tutors provide step by step solutions to help you excel in your courses