Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def diplay_Code(word):
- result_char = char(word)
- print(f'Character in Morse Code: {result_char} ')
- for i in word:
- print('Number in Morse code:', number(i))
- def get_string():
- return input('String to morse: ')
- def char(word):
- if word == ' ':
- return 'space'
- elif word == ',':
- return '--..--'
- elif word == '.':
- return '.-.-.-'
- elif word == '?':
- return '..--..'
- def number(word):
- return ['-----', '.----', '..---', '...--', '....-', '.....', '-....', '--...', '---..', '----.'][int(word)]
- diplay_Code(get_string())
Add Comment
Please, Sign In to add comment