Challenge

Past

One concept, three rungs. Reaching rung 1 is the goal, so climb as far as you can.

Name Tags

strings + first letters

Rung 1Daily goal5 points

First letter of each name

Write a function called first_letters

You get a list of names, and no name is ever empty. Return a new list holding just the first letter of each name.

Examples

InputOutput
["Amy", "Bob"]["A", "B"]
[][]
["Zoe"]["Z"]
["amy", "Amy"]["a", "A"]

There are extra hidden tests, so make it work in general, not just for these.

Rung 2Bonus7 points

Glue them together

Write a function called initials

Return one string made of the first letter of every name joined together. ["Amy", "Bob"] gives "AB". An empty list gives an empty string.

Examples

InputOutput
["Amy", "Bob"]"AB"
[]""
["Zoe"]"Z"
["amy", "Bob"]"aB"

There are extra hidden tests, so make it work in general, not just for these.

Rung 3Bonus10 points

Count a starting letter

Write a function called count_starting_with

Count how many names start with the given letter. Big and small letters count as the same, so "a" matches both "Amy" and "alex". The .lower() trick turns a letter into its small version.

Examples

InputOutput
["Amy", "alex", "Bob"], "a"2
[], "a"0
["Bob"], "B"1
["Amy"], "z"0

There are extra hidden tests, so make it work in general, not just for these.

Finish Rung 1 and today counts. Rungs 2 and 3 are there if you want to push further.