Ask Question

Write a functiongetNumber () that takes an upper case letter and returns thenumber according to the international standard above. Write a test program that prompts the user to enter a phone number as a string. The input number may contain letters. The program translates a letter (uppercaseor lowercase) to a digit and leaves all other characters intact. Here are sample runs of the program:Enter a string: 1-800 - Flowers1 - 800 - 3569377Enter a string: 1800 flower

+2
Answers (1)
  1. 6 August, 15:09
    0
    Answer / Explanation:

    To properly answer this question, we will utilize the python programming language.

    The Python programming language is a general purpose and high level programming language. You can use Python for developing desktop GUI applications, websites and web applications. Also, it allows you to focus on core functionality of the application by taking care of common programming tasks.

    Now, moving forward to write the program, we have:

    def string_test (s):

    d={"UPPER_CASE":0, "LOWER_CASE":0}

    for c in s:

    if c. isupper ():

    d["UPPER_CASE"]+=1

    elif c. islower ():

    d["LOWER_CASE"]+=1

    else:

    pass

    print ("Original String : ", s)

    print ("No. of Upper case characters : ", d["UPPER_CASE"])

    print ("No. of Lower case Characters : ", d["LOWER_CASE"])

    string_test ('Enter Phone Number')
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a functiongetNumber () that takes an upper case letter and returns thenumber according to the international standard above. Write a ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers