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.7 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
6a15cadf5f240d05a264955a Challenge 316: 1337 Speak 29 challenge-316

--description--

Given a lowercase string, return it translated into leet speak by replacing the letters below with their leet substitutions:

Letter Leet
a 4
e 3
g 9
i 1
l 1
o 0
s 5
t 7
  • Characters with no substitution are left unchanged.

--hints--

make_leet("cool") should return "c001".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(make_leet("cool"), "c001")`)
}})

make_leet("leet") should return "1337".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(make_leet("leet"), "1337")`)
}})

make_leet("hacker") should return "h4ck3r".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(make_leet("hacker"), "h4ck3r")`)
}})

make_leet("satellite") should return "547311173".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(make_leet("satellite"), "547311173")`)
}})

make_leet("abcdefghijklmnopqrstuvwxyz") should return "4bcd3f9h1jk1mn0pqr57uvwxyz".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(make_leet("abcdefghijklmnopqrstuvwxyz"), "4bcd3f9h1jk1mn0pqr57uvwxyz")`)
}})

--seed--

--seed-contents--

def make_leet(s):

    return s

--solutions--

def make_leet(s):
    leet_map = {"a": "4", "e": "3", "g": "9", "i": "1", "l": "1", "o": "0", "t": "7", "s": "5"}
    return "".join(leet_map.get(c, c) for c in s)