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
The ____ category of apps makes the computer easier for blind people to use.
Schach [20]

The accessibility category of apps makes the computer easier for blind people to use. In general the accessibility apps are apps that help people with disabilities use a particular piece of hardware. For example there is an app designed to help blind people use their devices by paring them with a voluntary non-blind people trough audio-video connections.





4 0
3 years ago
You can use tables for layout work. However, in XHTML, each form control should have its own ______ element
777dan777 [17]

Answer:

c. label

Explanation:

4 0
3 years ago
The purpose of an interface is to:___________
Galina-37 [17]

Answer:

Purpose of the interface

Provides communication − One of the uses of the interface is to provide communication. Through interface you can specify how you want the methods and fields of a particular type.Jul

8 0
3 years ago
Need help asap please
Bumek [7]

Answer:

options is right

Explanation:

3 0
2 years ago
Over time, programming languages have evolved in phases called ________.
Tju [1.3M]
Programming Languages have evolved in phases called generations.  The five generations of computers are : <span>First Generation (1940-1956) Vacuum Tubes. Second Generation (1956-1963) Transistors. Third Generation (1964-1971) Integrated Circuits. Fourth Generation (1971-Present) Microprocessors. <span>Fifth Generation (Present and Beyond) Artificial Intelligence.</span></span>     
6 0
3 years ago
Read 2 more answers
Other questions:
  • Given the following class import java.util.ArrayList; public class RectangleTester { public static void main(String[ ] args) { A
    7·1 answer
  • George and Miguel want to know more about their local and online competitors and about the retail industry. What is the best way
    9·1 answer
  • Fill in the blank.
    7·1 answer
  • Hosts A and B are communicating over a TCP connection, and Host B has already received from A all bytes up through byte 126. Sup
    10·1 answer
  • What is the printout (display) of the following program? public class Test { public static void main(String[] args) { int[][] va
    9·1 answer
  • The best place to start when you are looking for information about a device or an application is the ____ of the company that ma
    14·1 answer
  • What is the output of the C++ codeabove?
    14·1 answer
  • Help it don’t let me click what do I do
    13·1 answer
  • "Rights and duties are two sides of the same coin." Explain with examples​
    5·1 answer
  • All _______ that store more than one piece of data ​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!