Files
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

1.6 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
69bc6cb30c1d112a2e110a03 Challenge 246: Name Initials 29 challenge-246

--description--

Given a full name as a string, return their initials.

  • Names to initialize are separated by a space.
  • Initials should be made uppercase.
  • Initials should be separated by dots.

For example, "Tommy Millwood" returns "T.M.".

--hints--

get_initials("Tommy Millwood") should return "T.M.".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_initials("Tommy Millwood"), "T.M.")`)
}})

get_initials("Savanna Puddlesplash") should return "S.P.".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_initials("Savanna Puddlesplash"), "S.P.")`)
}})

get_initials("Frances Cowell Conrad") should return "F.C.C.".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_initials("Frances Cowell Conrad"), "F.C.C.")`)
}})

get_initials("Dragon") should return "D.".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_initials("Dragon"), "D.")`)
}})

get_initials("Dorothy Vera Clump Haverstock Norris") should return "D.V.C.H.N.".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_initials("Dorothy Vera Clump Haverstock Norris"), "D.V.C.H.N.")`)
}})

--seed--

--seed-contents--

def get_initials(name):

    return name

--solutions--

def get_initials(name):
    return ''.join(word[0].upper() + '.' for word in name.split())