7 kyu

Coding Meetup #4 - Higher-Order Functions Series - Find the first Python developer

7,807 of 10,018PiotrBerebecki

Description:

You will be given an array of objects (associative arrays in PHP) representing data about developers who have signed up to attend the next coding meetup that you are organising. The list is ordered according to who signed up first.

Your task is to return one of the following strings:

  • < firstName here >, < country here > of the first Python developer who has signed up; or
  • There will be no Python developers if no Python developer has signed up.

For example, given the following input array:

var list1 = [
  { firstName: 'Mark', lastName: 'G.', country: 'Scotland', continent: 'Europe', age: 22, language: 'JavaScript' },
  { firstName: 'Victoria', lastName: 'T.', country: 'Puerto Rico', continent: 'Americas', age: 30, language: 'Python' },
  { firstName: 'Emma', lastName: 'B.', country: 'Norway', continent: 'Europe', age: 19, language: 'Clojure' }
];
$list1 = [
  [
    "first_name" => "Mark",
    "last_name" => "G.",
    "country" => "Scotland",
    "continent" => "Europe",
    "age" => 22,
    "language" => "JavaScript"
  ],
  [
    "first_name" => "Victoria",
    "last_name" => "T.",
    "country" => "Puerto Rico",
    "continent" => "Americas",
    "age" => 30,
    "language" => "Python"
  ],
  [
    "first_name" => "Emma",
    "last_name" => "B.",
    "country" => "Norway",
    "continent" => "Europe",
    "age" => 19,
    "language" => "Clojure"
  ]
];
list1 = [
  { "first_name": "Mark", "last_name": "G.", "country": "Scotland", "continent": "Europe", "age": 22, "language": "JavaScript" },
  { "first_name": "Victoria", "last_name": "T.", "country": "Puerto Rico", "continent": "Americas", "age": 30, "language": "Python" },
  { "first_name": "Emma", "last_name": "B.", "country": "Norway", "continent": "Europe", "age": 19, "language": "Clojure" }
]
       01  List.
          03  ListLength      pic 9(3) value 3.
          03  dev1.
              05 FirstName    pic a(9)  value 'Mark'.
              05 LastName     pic x(2)  value 'G.'.
              05 Country      pic a(24) value 'Scotland'.
              05 Continent    pic a(8)  value 'Europe'.
              05 Age          pic 9(3)  value 52.
              05 Language     pic a(10) value 'JavaScript'.
          03  dev2.
              05 FirstName    pic a(9)  value 'Victoria'.
              05 LastName     pic x(2)  value 'T.'.
              05 Country      pic a(24) value 'Puerto Rico'.
              05 Continent    pic a(8)  value 'Americas'.
              05 Age          pic 9(3)  value 70.
              05 Language     pic a(10) value 'Python'.
          03  dev3.
              05 FirstName    pic a(9)  value 'Emma'.
              05 LastName     pic x(2)  value 'B.'.
              05 Country      pic a(24) value 'Norway'.
              05 Continent    pic a(8)  value 'Europe'.
              05 Age          pic 9(3)  value 19.
              05 Language     pic a(10) value 'Clojure'.

your function should return Victoria, Puerto Rico.

Notes:

  • The input array will always be valid and formatted as in the example above.




This kata is part of the Coding Meetup series which includes a number of short and easy to follow katas which have been designed to allow mastering the use of higher-order functions. In JavaScript this includes methods like: forEach, filter, map, reduce, some, every, find, findIndex. Other approaches to solving the katas are of course possible.

Here is the full list of the katas in the Coding Meetup series:

Coding Meetup #1 - Higher-Order Functions Series - Count the number of JavaScript developers coming from Europe

Coding Meetup #2 - Higher-Order Functions Series - Greet developers

Coding Meetup #3 - Higher-Order Functions Series - Is Ruby coming?

Coding Meetup #4 - Higher-Order Functions Series - Find the first Python developer

Coding Meetup #5 - Higher-Order Functions Series - Prepare the count of languages

Coding Meetup #6 - Higher-Order Functions Series - Can they code in the same language?

Coding Meetup #7 - Higher-Order Functions Series - Find the most senior developer

Coding Meetup #8 - Higher-Order Functions Series - Will all continents be represented?

Coding Meetup #9 - Higher-Order Functions Series - Is the meetup age-diverse?

Coding Meetup #10 - Higher-Order Functions Series - Create usernames

Coding Meetup #11 - Higher-Order Functions Series - Find the average age

Coding Meetup #12 - Higher-Order Functions Series - Find GitHub admins

Coding Meetup #13 - Higher-Order Functions Series - Is the meetup language-diverse?

Coding Meetup #14 - Higher-Order Functions Series - Order the food

Coding Meetup #15 - Higher-Order Functions Series - Find the odd names

Coding Meetup #16 - Higher-Order Functions Series - Ask for missing details

Functional Programming
Data Structures
Arrays
Fundamentals
Algorithms
Strings
Regular Expressions

Stats:

CreatedNov 13, 2016
PublishedNov 13, 2016
Warriors Trained12355
Total Skips249
Total Code Submissions29133
Total Times Completed10018
JavaScript Completions7807
PHP Completions252
Python Completions1956
Ruby Completions148
Crystal Completions10
COBOL Completions7
Total Stars149
% of votes with a positive feedback rating95% of 1568
Total "Very Satisfied" Votes1421
Total "Somewhat Satisfied" Votes129
Total "Not Satisfied" Votes18
Total Rank Assessments8
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • PiotrBerebecki Avatar
  • GiacomoSorbi Avatar
  • user8476848 Avatar
  • donaldsebleung Avatar
  • Chrono79 Avatar
  • akar-0 Avatar
  • dfhwze Avatar
  • saudiGuy Avatar
Ad