Z10945: Difference between revisions
simplify the implementation using comprehension |
translate |
||
(6 intermediate revisions by 5 users not shown) | |||
Line 14: | Line 14: | ||
"Z61K1": "python" |
"Z61K1": "python" |
||
}, |
}, |
||
"Z16K2": "def Z10944(Z10944K1):\n\timport re\n\t\n\tMORSE_DICT = {\n\t\t\"a\": \".-\",\n\t\t\"b\": \"-...\",\n\t\t\"c\": \"-.-.\",\n\t\t\"d\": \"-..\",\n\t\t\"e\": \".\",\n\t\t\"é\": \"..-..\",\n\t\t\"f\": \"..-.\",\n\t\t\"g\": \"--.\",\n\t\t\"h\": \"....\",\n\t\t\"i\": \"..\",\n\t\t\"j\": \".---\",\n\t\t\"k\": \"-.-\",\n\t\t\"l\": \".-..\",\n\t\t\"m\": \"--\",\n\t\t\"n\": \"-.\",\n\t\t\"o\": \"---\",\n\t\t\"p\": \".--.\",\n\t\t\"q\": \"--.-\",\n\t\t\"r\": \".-.\",\n\t\t\"s\": \"...\",\n\t\t\"t\": \"-\",\n\t\t\"u\": \"..-\",\n\t\t\"v\": \"...-\",\n\t\t\"w\": \".--\",\n\t\t\"x\": \"-..-\",\n\t\t\"y\": \"-.--\",\n\t\t\"z\": \"--..\",\n\t\t\"1\": \".----\",\n\t\t\"2\": \"..---\",\n\t\t\"3\": \"...--\",\n\t\t\"4\": \"....-\",\n\t\t\"5\": \".....\",\n\t\t\"6\": \"-....\",\n\t\t\"7\": \"--...\",\n\t\t\"8\": \"---..\",\n\t\t\"9\": \"----.\",\n\t\t\"0\": \"-----\",\n\t\t\".\": \".-.-.-\",\n\t\t\",\": \"--.--\",\n\t\t\":\": \"---...\",\n\t\t\"?\": \"..--..\",\n\t\t\"'\": \".----.\",\n\t\t\"-\": \"-....-\",\n\t\t\"–\": \"-....-\",\n\t\t\"—\": \"-....-\",\n\t\t\"/\": \"-..-.\",\n\t\t\"(\": \"-.--.\",\n\t\t\")\": \"-.--.-\",\n\t\t\"\\\"\": \".-..-.\",\n\t\t\"“\": \".-..-.\",\n\t\t\"”\": \".-..-.\",\n\t\t\"=\": \"-...-\",\n\t\t\"+\": \".-.-.\",\n\t\t\"×\": \"-..-\",\n\t\t\"@\": \".--.-.\",\n\t\t\" \": \"/\",\n\t}\n\t\n\tin_str = Z10944K1.strip().lower()\n\tin_str = re.sub(r\"\\s+\", \" \", |
"Z16K2": "def Z10944(Z10944K1):\n\timport re\n\t\n\tMORSE_DICT = {\n\t\t\"a\": \".-\",\n\t\t\"b\": \"-...\",\n\t\t\"c\": \"-.-.\",\n\t\t\"d\": \"-..\",\n\t\t\"e\": \".\",\n\t\t\"é\": \"..-..\",\n\t\t\"f\": \"..-.\",\n\t\t\"g\": \"--.\",\n\t\t\"h\": \"....\",\n\t\t\"i\": \"..\",\n\t\t\"j\": \".---\",\n\t\t\"k\": \"-.-\",\n\t\t\"l\": \".-..\",\n\t\t\"m\": \"--\",\n\t\t\"n\": \"-.\",\n\t\t\"o\": \"---\",\n\t\t\"p\": \".--.\",\n\t\t\"q\": \"--.-\",\n\t\t\"r\": \".-.\",\n\t\t\"s\": \"...\",\n\t\t\"t\": \"-\",\n\t\t\"u\": \"..-\",\n\t\t\"v\": \"...-\",\n\t\t\"w\": \".--\",\n\t\t\"x\": \"-..-\",\n\t\t\"y\": \"-.--\",\n\t\t\"z\": \"--..\",\n\t\t\"1\": \".----\",\n\t\t\"2\": \"..---\",\n\t\t\"3\": \"...--\",\n\t\t\"4\": \"....-\",\n\t\t\"5\": \".....\",\n\t\t\"6\": \"-....\",\n\t\t\"7\": \"--...\",\n\t\t\"8\": \"---..\",\n\t\t\"9\": \"----.\",\n\t\t\"0\": \"-----\",\n\t\t\".\": \".-.-.-\",\n\t\t\",\": \"--..--\",\n\t\t\":\": \"---...\",\n\t\t\"?\": \"..--..\",\n\t\t\"'\": \".----.\",\n\t\t\"-\": \"-....-\",\n\t\t\"–\": \"-....-\",\n\t\t\"—\": \"-....-\",\n\t\t\"/\": \"-..-.\",\n\t\t\"(\": \"-.--.\",\n\t\t\")\": \"-.--.-\",\n\t\t\"\\\"\": \".-..-.\",\n\t\t\"“\": \".-..-.\",\n\t\t\"”\": \".-..-.\",\n\t\t\"=\": \"-...-\",\n\t\t\"+\": \".-.-.\",\n\t\t\"×\": \"-..-\",\n\t\t\"@\": \".--.-.\",\n\t\t\" \": \"/\",\n\t}\n\t\n\tin_str = Z10944K1.strip().lower()\n\tin_str = re.sub(r\"\\s+\", \" \", in_str)\n\t\n\treturn ' '.join(\n\t\tMORSE_DICT[c]\n\t\tfor c in in_str\n\t\tif c in MORSE_DICT\n\t)" |
||
} |
} |
||
}, |
}, |
||
Line 25: | Line 25: | ||
"Z11K1": "Z1002", |
"Z11K1": "Z1002", |
||
"Z11K2": "international morse code encode in Python" |
"Z11K2": "international morse code encode in Python" |
||
}, |
|||
{ |
|||
"Z1K1": "Z11", |
|||
"Z11K1": "Z1430", |
|||
"Z11K2": "Internationaler Morsecode enkodieren in Python" |
|||
}, |
|||
{ |
|||
"Z1K1": "Z11", |
|||
"Z11K1": "Z1531", |
|||
"Z11K2": "mengekod kod morse dalam Python" |
|||
}, |
|||
{ |
|||
"Z1K1": "Z11", |
|||
"Z11K1": "Z1434", |
|||
"Z11K2": "مڠکود کود مورس دالم ڤايثون" |
|||
} |
} |
||
] |
] |
||
Line 37: | Line 52: | ||
"Z1K1": "Z12", |
"Z1K1": "Z12", |
||
"Z12K1": [ |
"Z12K1": [ |
||
"Z11" |
"Z11", |
||
{ |
|||
"Z1K1": "Z11", |
|||
"Z11K1": "Z1430", |
|||
"Z11K2": "wandelt einen Text in Internationalen Morsecode um, Implementierung in Python" |
|||
} |
|||
] |
] |
||
} |
} |
Revision as of 21:20, 7 April 2024
This page displays in a limited way without JavaScript.