How to convert any word into Morse code using Python 🐍 #Python #project #coding #tech #shorts

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

MORSE = {
'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..',
'E': '.', 'F': '..-.', 'G': '--.', 'H': '....',
'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..',
'M': '--', 'N': '-.', 'O': '---', 'P': '.--.',
'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-',
'U': '..-', 'V': '...-', 'W': '.--', 'X': '-..-',
'Y': '-.--', 'Z': '--..'
}

text = input("Enter text (A-Z): ").upper()
morse = ' '.join(MORSE.get(c, '') for c in text if c.isalpha())
print("Morse Code:", morse)

XpertCoder__
welcome to shbcf.ru