fork download
  1. import re
  2. text = """Ukraine[a] is a country in Eastern Europe. It is the second-largest country in Europe after Russia,
  3. which borders it to the east and northeast.[b] Ukraine also borders Belarus to the north;
  4. Poland and Slovakia to the west; Hungary, Romania and Moldova[c] to the southwest;
  5. and the Black Sea and the Sea of Azov to the south and southeast.[d]
  6. Kyiv is the nation's capital and largest city, followed by Kharkiv, Odesa, and Dnipro.
  7. Ukraine's official language is Ukrainian."""
  8. words = re.findall(r"[A-Za-z]+", text)
  9. allowed_start = ("I", "Y", "K", "L", "M", "N")
  10. IDN = [w for w in words if w.startswith(allowed_start)]
  11. print("Масив IDN:", IDN)
Success #stdin #stdout 0.2s 15464KB
stdin
Standard input is empty
stdout
Масив IDN: ['It', 'Moldova', 'Kyiv', 'Kharkiv']