Back
Close

Survey Prediction

Statement

 Goal

Your manager has given you a file containing survey answers of what genre of music people of different genders and ages like, but for some reason some people answered without specifying the genre, so you need to predict what genres they like based on other people's answers. Unfortunately, you cannot do this without the help of coding. Assuming that the answers given on the survey are a 100% correct, you are to create a program that takes the survey answers and predicts the genres of each person given their age and their gender.

For an example, males of ages 20-27 like rock, so a male that is 23 years old would also like rock. while females of ages 20-27 like hip hop, so a 23 year old female would like hip hop.

Survey answers are the ones that have an age, gender and a genre. the data you need to predict the genres for have an age and a gender only.

If you can't specify what genre they like, e.g. the given age/gender is not included in the survey answers, simply print None.
Input
Line 1: An integer n for the amount of survey answers plus the missing
Next n lines: Survey answers and answers with missing genres
Output
Genre each person which didn't answer likes
Constraints
2 < n ≤ 20
Example
Input
3
23 female hip-hop
30 female hip-hop
24 female
Output
hip-hop

Tags
Machine learning

Difficulty
Easy

Test cases
2 Answers and 1 Missing Test
Input
3 23 female hip-hop 30 female hip-hop 24 female
Output
hip-hop

Validator 1 Validator
Input
3 23 male rock 25 male rock 24 male
Output
rock

5 Answers and 3 Missing Test
Input
8 50 female classical 60 female classical 50 male country 52 female classical 53 male country 55 female 60 female 55 male
Output
classical classical None

Validator 2 Validator
Input
8 20 female metal 30 female metal 40 female metal 40 male rap 50 male rap 42 male 43 male 39 female
Output
rap rap metal

Even answers and missing Test
Input
20 16 female pop 17 female jazz 20 female jazz 16 male funk 19 male funk 21 male funk 21 female hip-hop 25 male metal 29 male metal 31 male metal 29 male 16 female 17 female 19 female 21 female 20 female 26 male 31 male 27 male 31 female
Output
metal pop jazz jazz hip-hop jazz metal metal metal None

Validator 3 Validator
Input
4 10 female acoustic 12 female acoustic 8 female 9 female
Output
None None

6 Answers, 6 Missing Test
Input
12 21 male jazz 66 male country 21 female jazz 0 male nothing 50 female country 25 male metal 0 male 21 male 21 female 50 female 25 male 66 male
Output
nothing jazz jazz country metal country

Validator 4 Validator
Input
6 25 male hip-hop 26 male jazz 27 male jazz 25 male 28 male 29 female
Output
hip-hop None None

Everything None Test
Input
3 25 female rock 25 male 22 female
Output
None None

Validator 5 Validator
Input
3 25 male rock 25 female 23 male
Output
None None

Solution language

Solution

Stub generator input