1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ANTONII [103]
3 years ago
10

Write another function to convert a value to its word equivalent leveraging the following tuple - o Number = (‘One’, ‘Two’, … ‘N

ine’) # Expand this into a tuple o Example: 1234 would be converted to One Two Three Four
Computers and Technology
1 answer:
prohojiy [21]3 years ago
7 0

Answer:

  1. def convertStr(num):
  2.    Number = ("One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine")
  3.    numStr = str(num)
  4.    output = ""
  5.    for x in numStr:
  6.        index = int(x) - 1
  7.        output += Number[index] + " "
  8.    return output
  9. value = 1234
  10. print(convertStr(value))

Explanation:

Firstly, create a function convertStr that take one input number (Line 1).

This function convert the input number to string (Line 3) and then use for-loop to traverse through the individual digit (Line 6). In the loop, get the target index to extract the corresponding digit letter from the Number tuple(Line 7). The target index is always equal to the current digit number - 1. Next, join the extracted digit letter from the tuple to an output string (Line 8) and return it at the end of the function (Line 10).

We test the function using 1234 as argument (Line 12 - 13) and we shall get One Two Three Four

You might be interested in
a. Daily Life Magazine wants an analysis of the demographic characteristics of its readers. The marketing department has collect
kherson [118]

Answer:

uh

Explanation:

7 0
2 years ago
How do you repair a USB?
kaheart [24]

Answer:

You can also try to fix corrupted USB drives with First Aid.

Go to Applications > Disk Utility.

Select the USB drive from the sidebar of Disk Utility.

Click First Aid on the top of the window.

Click Run on the pop-up window.

Wait until the scanning process finished.

Explanation:

8 0
3 years ago
Read 2 more answers
What is computer system<br>explain the role of bank in computer<br>​
vodomira [7]

Answer:

This is your answer please check this ✔

5 0
2 years ago
Read 2 more answers
A person you respect who offers you advice and assistance is known as a(n) _____.
Archy [21]
This would be a mentor-D. They role is to mentor or guide you with advice or assistance. A role model is a similar answer in that they respect you, but they might not offer advice or assistance which makes it incorrect.
7 0
2 years ago
During boom times, which of the
pashok25 [27]
I think the answer is D.
3 0
2 years ago
Other questions:
  • Some financial institutions can be really bad about putting unexpected charges
    12·1 answer
  • ___MSDS provides information on how to handle, store, discard and care for potentially hazardous chemicals. true or false?​
    5·1 answer
  • Who initially developed what is now known as the internet?
    5·1 answer
  • What is human data,
    8·1 answer
  • This is the term for the manual process of editing strips of the film before digital editing was created. The term is still used
    9·1 answer
  • Write a for loop that runs 5 times and accepts the input of an integer number every time. Those numbers will be accumulated by a
    7·1 answer
  • When an external device becomes ready to be serviced by the processor the device sends a(n)_________ signal to the processor.
    8·1 answer
  • Which media vehicle uses the Dreamweaver software for its design? A(n) "blank" uses the Dreamweaver software for its design.
    8·1 answer
  • True or False? You should never move an injured person.<br> True<br> False
    6·1 answer
  • Upload your completed project including the following:
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!