Home ›
Coding › Below is an instruction that describes a task. Write a respo...
Below is an instruction that describes a task. Write a respo...
Coding · Gemini, GPT-5.6, Claude · Coding
56Quality
87%Useful
85Reliability
The prompt
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Create a Python program that takes a sentence and converts it to Morse code. ### Input: Not applicable ### Output: MORSE_CODE = { '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': '--..', '0': '-----', '1': '.----', '2': '..---', '3': '...--', '4': '....-', '5': '.....', '6': '-....', '7': '--...', '8': '---..', '9': '----.', ' ': ' ', '.': '.-.-.-', ',': '--..--', '?': '..--..', '/': '-..-.', '-': '-....-', '(': '-.--.-', ')': '-.--.-' } def encode(message): code = '' for letter in message: code += MORSE_CODE[letter.upper()] + ' ' return code print(encode("Hello world")) # Output: .... . .-.. .-.. --- .-- --- .-. .-.. -..
Find similar in the app →
Why this prompt
- AI-graded 56/100 for quality and structure
- Reusable template — swap in {TOPIC}
- 87% found it useful across Gemini, GPT-5.6, Claude
Source
Hugging Face
Related Coding prompts
PRD to MVP Technical Plan
Quality 93 · Claude CodeFull-Stack CRUD App Builder
Quality 93 · Claude CodeLegacy Refactor Planner
Quality 93 · Claude CodeTest Suite Generator
Quality 93 · Claude CodeThird-Party API Integration
Quality 93 · Claude CodeDatabase Schema and Migration
Quality 93 · Claude Code