Python Forum
morse code assignment
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
morse code assignment
#11
(Jul-29-2019, 06:13 PM)ichabod801 Wrote: If you do what jefsummers said, which is what I was talking about with the range(4), it will solve that problem with letters.

Thanks Im not getting it I will just have to step away I guess and revisit.....this happens to me when I try to hard and over think things.....
Thanks everyone
Reply
#12
I stepped away and came back with fresh eyes and there it was......I THINK. It works anyway..lol
Thank you all very much as always

def text_to_morse(letter):
    if letter == "A":
        code = ".-"
    elif letter == "B":
        code = "-..."
    elif letter == "C":
        code = "-.-."
    elif letter == "D":
        code = "-.."
    return code
for letter in range(4): 
    letter =(input("Please enter upper case letter to convert to morse code: "))
    code = text_to_morse(letter)
    print("Your code for {} is {}.".format(letter,code))
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Morse Assignment Cambridge 3 2,375 Feb-02-2021, 02:40 AM
Last Post: Larz60+
  Write pseudo code for a class assignment Scrimshot 3 3,328 May-07-2019, 05:38 PM
Last Post: Scrimshot
  Need some help with a bit of code for an assignment. JackMercer50 1 2,251 Feb-09-2019, 04:13 PM
Last Post: stullis
  Need help with lists to continue my assignment code tinabina22 9 10,265 Oct-12-2016, 12:20 AM
Last Post: Yoriz
  [split] Need help with lists to continue my assignment code cylandur 7 9,308 Oct-11-2016, 03:11 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020