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
You can use a(n) to call a function in response to an event?
uranmaximum [27]

Answer:

Simply put: A callback is a function that is to be executed after another function has finished executing — hence the name 'call back'. ... Functions that do this are called higher-order functions. Any function that is passed as an argument is called a callback function.

Explanation:

6 0
3 years ago
What is the major benefit Smartphones and tablet computers have had on social media?
Naddika [18.5K]

Answer:

c

Explanation:

The biggest advantage of smartphones and tablets is that they increased the mobility. This allowed users to access the social media platforms whenever they want. The users can login to their accounts even they are travelling by bus or walking around. This was not possible back in the days where people mostly use desktop computers.

8 0
3 years ago
To determine why a computer program started to function differently, Mel should most likely use data to
Amiraneli [1.4K]

Answer:

convince the software company of the issue

Explanation:

3 0
3 years ago
Read 2 more answers
If a thread is not finished running, perhaps because it had to wait or it was preempted, it is typically restarted on the same p
andrew11 [14]
<span>If a thread is not finished running, perhaps because it had to wait or it was preempted, it is typically restarted on the same processor that previously ran it.  This is this known as </span>processor affinity. 
4 0
3 years ago
A real estate office handles 50 apartment units. When the rent is $600 per month, all the units are occupied. However, for each
Vesnalui [34]

Answer:

452

Explanation:

7 0
3 years ago
Other questions:
  • Write a cout statement that prints the value of a conditional expression. The conditional expression should determine whether th
    7·1 answer
  • Which of the following is a key component to your individual internet safety? government regulations
    13·1 answer
  • You are required to design a 4-bit even up-counter using D flip flop by converting combinational circuit to sequential circuit.
    15·1 answer
  • What is the duty of business to contribute to the well-being of society
    12·1 answer
  • What are two examples of management information systems?
    12·1 answer
  • Should the federal government have bug bounty programs? Why or why not?
    9·2 answers
  • Convert the following hexadecimal numbers to decimal: (a) FF (b) F0A2 (c) 0F100 (d) 100
    10·1 answer
  • Hey guys im just curious.... whats ur favorite number
    6·2 answers
  • Which command is used to copy entire folder structures between volumes or across a network while maintaining all NTFS file permi
    10·1 answer
  • How tp access to all tools in ms word
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!