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,

please used in basic python language! thank youimage text in transcribed

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 O 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

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

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions