Question: Morse Code Python Help So this is my homework in Python. I think I have part 1 all set, but I'm not quite sure how

Morse Code Python Help

So this is my homework in Python. I think I have part 1 all set, but I'm not quite sure how to move forward (we never did the homework 10that is mentioned in the fall semester class) I have attached some photos and would appreciate any help!

Morse Code Python Help So this is my homework in Python. Ithink I have part 1 all set, but I'm not quite surehow to move forward (we never did the homework 10that is mentioned

c. If the input string is a / (which is not valid Morse code), return a space. We are using this to separate words. d. If a match is not found, return a * e. Your function must have a docstring which describes what the function does (see PHY 2601 Lab #8, 3.a.iv). 2. Load the file morse.txt. This file contains a message from the developer of the game "One Hour, One Life regarding an update allowing radio transmission in this survival game. Letters are separated by spaces and words by /. You will want to use the .split(") method (with the input string containing a space) to separate the dashes and dots into segments which represent a single letterumber/special character (see PHY 2601 Lab #10, 1.c.v.2). a. Remember to close the file when you are done with it! 3. Loop through each Morse code character and call morese2alpha to return the alphanumeric character. Concatenate each character together to construct the translated message. a. You may read in empty characters. Skip translating these; i.e. make you code robust enough to know if the character you are working with is empty and then skip it. 4. Display the translated message on the screen. def morse2alpha(mystring): # defining the function Parameters mystring TYPE: If statements, string function DESCRIPTION: Defining morse code for each alphanumerical by using if state Returns myfinalstring TYPE: String outcome of a string function DESCRIPTION: Setting each alphanumeric and its morse code as a variable myfinalstring = "' #establishing the return function for L in mystring: 1 = L. lower() #allows code to work for uppercase and lowercase letters if 1 == '.-': # defining if statement for letter a return 'A' # morse code for a if I == '-...': # defining if statement for letter b return 'B' # morse code for b if l == '-.-.': return 'C' if l == '-..': return 'D' if 1 = return 'El if 1 = '-..-. return '/' if 1 == '-.--.': return '( if 1 == '-.--.-': return'' if l == '-.-.--': return 'I' else: pass # not doing anything for if 1 is not equal to any letter, nu myfinalstring myfinalstring + ' ' # adding a space return myfinalstring # completing the function by using the return

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!