PYTHON Create a proof-of-concept Morse Code translation application. For 'proof-of-concept', a partial implementation is good enough. Rather than translating every Morse Code character, just a handful will do. Use the letters from your first name, all upper case. Note that Morse Code characters consist of one or more dots or dashes. For example, the Morse Code for 'S' is '...' and for 'O' is '---'. See https://morsecode.scphillips.com/translator.html (Links to an external site.) for more info on Morse code. Be sure to include header comments in each step! Step 1  In this step, you'll set up the logic to convert letters to Morse code.  Create an application that asks the user to enter an upper case letter. Use an if-elif construct to determine which letter was entered and store the appropriate Morse code string in a variable. If there is no match, set the variable to "Unknown". As an example, the Morse code for the letter 'S' is represented using a string of three periods, "...", for dot dot dot. The Morse code for "O" is represented by three hyphens, "---", for dash dash dash. Display the variable. Save the program as step_1.py. Step 2  In this step, you'll create a function to do the translation. This will make it easy to reuse the code for the if-elif logic without having to make lots of copies later on. Copy step_1.py into a new program and call it step_2.py Create a function named text_to_morse. The function should have one parameter, which contains the letter to be translated. Note that the function should be located at the top of the program just underneath the header comments. Move just the if-elif code into the function, remembering to indent it. But, do not include the input statement or the print statement. Add a return statement to the function that returns the variable containing the result. Note that functions are used to modularize the work effort, the job of text_to_morse is only to translate letter into Morse code, not to format a message. As such, only the Morse code should be returned by the function, not a fully formatted message. And, there should be no interaction with the user (i.e. no input() or print() statements) within the function - that's the job of the main program. After the input statement, add a call to the function using the input variable as the argument to the function. Store the value returned by the function in a variable and display it. Step 3  Here's where you put it all together. You'll be translating several Morse codes but instead of making copies of the if-elif logic for each translation, instead you will call the text_to_morse function. Create a program called step_3.py. Copy your text_to_morse function from step 2 to the top of the program, just under the header comments. Do the following four times in a row: Ask the user to enter a text character to be converted to Morse code. Call the text_to_morse function to get the equivalent Morse code. Display the text letter and its equivalent Morse code.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

 PYTHON

Create a proof-of-concept Morse Code translation application. For 'proof-of-concept', a partial implementation is good enough. Rather than translating every Morse Code character, just a handful will do. Use the letters from your first name, all upper case.

Note that Morse Code characters consist of one or more dots or dashes. For example, the Morse Code for 'S' is '...' and for 'O' is '---'. See https://morsecode.scphillips.com/translator.html (Links to an external site.) for more info on Morse code.

Be sure to include header comments in each step!

Step 1 

In this step, you'll set up the logic to convert letters to Morse code. 

Create an application that asks the user to enter an upper case letter.
Use an if-elif construct to determine which letter was entered and store the appropriate Morse code string in a variable. If there is no match, set the variable to "Unknown".
As an example, the Morse code for the letter 'S' is represented using a string of three periods, "...", for dot dot dot.
The Morse code for "O" is represented by three hyphens, "---", for dash dash dash.
Display the variable.
Save the program as step_1.py.
Step 2 

In this step, you'll create a function to do the translation. This will make it easy to reuse the code for the if-elif logic without having to make lots of copies later on.

Copy step_1.py into a new program and call it step_2.py
Create a function named text_to_morse. The function should have one parameter, which contains the letter to be translated. Note that the function should be located at the top of the program just underneath the header comments.
Move just the if-elif code into the function, remembering to indent it. But, do not include the input statement or the print statement.
Add a return statement to the function that returns the variable containing the result.
Note that functions are used to modularize the work effort, the job of text_to_morse is only to translate letter into Morse code, not to format a message. As such, only the Morse code should be returned by the function, not a fully formatted message. And, there should be no interaction with the user (i.e. no input() or print() statements) within the function - that's the job of the main program.
After the input statement, add a call to the function using the input variable as the argument to the function.
Store the value returned by the function in a variable and display it.
Step 3 

Here's where you put it all together. You'll be translating several Morse codes but instead of making copies of the if-elif logic for each translation, instead you will call the text_to_morse function.

Create a program called step_3.py.
Copy your text_to_morse function from step 2 to the top of the program, just under the header comments.
Do the following four times in a row:
Ask the user to enter a text character to be converted to Morse code.
Call the text_to_morse function to get the equivalent Morse code.
Display the text letter and its equivalent Morse code.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Use of XOR function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education