Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please used in basic python language! thank you Assume you have a list of gender information as following. gen = [f, 'M', female, Male, male,

image text in transcribedplease used in basic python language! thank you

Assume you have a list of gender information as following. gen = ["f", 'M', "female", "Male", "male", "F", "m", "m", "male", "Female", "x"] Due to different input formats, female may appear as "F", "f", "Female", or "female", and male may appear as "M", "m", "Male", or "male" in the list. Please turn the list into a new gender list called "gen2" with only Os and 1s, with 0 representing females, and 1 representing males. If there is any other elements in the list, we assume it as invalid and simply ignore it in our new list. Expected output: [0, 1, 0, 1, 1, 0, 1, 1, 1, 0] Noted that your program should be applicable when the values in the gen list change. 1 gen = ["f", 'M', "female", "Male", "male", "F", "m", "m", "male", "Female", "x"] 2. 3 # Start your code below

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

6. What is process reengineering? Why is it relevant to training?

Answered: 1 week ago