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]
2 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]2 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
Consider the following algorithms. Each algorithm operates on a list containing n elements, where n is a very large integer.
DochEvi [55]

We have that the appropriate statement will be

  • An algorithm that accesses only the first 10 elements in the list, regardless of the size of the list. Which of the algorithms run in reasonable time

III only.

Option B

From the question we are told

Consider the following <u>algorithms</u>. Each <u>algorithm</u> operates on a list containing n <em>elements</em>, where n is a very large <u>integer</u>.

I. An algorithm that accesses each <u>element</u> in the list twice.

II. An <em>algorithm </em>that accesses each <u>element </u>in the list n times.

III. An <u>algorithm</u> that accesses only the first 10 elements in the list, regardless of the size of the list. Which of the <em>algorithms </em>run in <em>reasonable </em>time?

<h3>Algorithm  </h3>

Generally In order to get <em>admission </em>to every thing in the list twice, the algorithm has to traverse the listing twice,

which leads to 2*n entry to operations.

And if the every factor is accessed n times, the listing will be traversed n time, which leads to n^2 get right of entry to operations.

If n is a very giant <em>integer</em>, each 2*n and n^2 are plenty larger.

So, there will be <em>solely </em>ten entry to operations and this algorithm will have a sensible jogging time.

Therefore

An algorithm that accesses only the first 10 elements in the list, regardless of the size of the list. Which of the algorithms run in reasonable time

III only.

Option B

For more information on  algorithm  visit

brainly.com/question/950632

4 0
2 years ago
) Which of these will not select all the cells in a document?
dolphi86 [110]
Pressing enter two times I’m pretty sure that’s right cuz like it does nothing when I do it. It’s either that or idk up to u to take an answer from someone who has bad grammar
4 0
2 years ago
In addition to benchmark testing, performance measurements, called _____, can monitor the number of transactions processed in a
Shalnov [3]

Answer:

metrics

Explanation:

Given that Metrics is Metrics is an accepted technique of measuring quantities of elements or commodities.

It is used in all facets of human activities particularly in value measurement such as production operation, financial assessment, comparison purposes, etc.

Hence, In addition to benchmark testing, performance measurements, called METRICS, can monitor the number of transactions processed in a given period, the number of records accessed, and the volume of online data.

3 0
2 years ago
The ____ auto fill option that fills the destination area using the format of the source area; no content is filled.
attashe74 [19]
The AUTO FORMATTING ONLY is an auto fill option that fills the destination area using the format of the source area; no content is filled. This is opposite from auto without formatting on which it fills the destination area without formatting.
5 0
3 years ago
Application software
Crazy boy [7]

Answer:

it would be B hope this helps

Explanation:

8 0
3 years ago
Other questions:
  • HELP! Answer to question 2?
    12·1 answer
  • The computers that run the DBMS and all devices that store database data should reside in locked, controlled-access facilities.
    15·1 answer
  • Write a program to solve the selection problem. Let k = N/2. Draw a table showing the running time of your program for various v
    12·1 answer
  • Digital Subscriber Line (DSL) is a way for traditional telephone companies to provide Internet access a way for traditional cabl
    10·2 answers
  • What are the conditions for using still photos in a video program
    6·1 answer
  • ____ devices are high-performance storage systems that are connected individually to a network to provide storage for the comput
    12·1 answer
  • While surfing online, Patricia checks her email and reads the latest messages. She then browsers a website and logs in a comment
    8·1 answer
  • Which of the following is considered a basic task in the context of computer operations? a. Connecting to the Internet b. Natura
    6·1 answer
  • Write a program that prompts the user to enter three words. The program will then sort the words in alphabetical order, and disp
    14·1 answer
  • ________ is a utility program included with most operating systems that allows you to move or eliminate files and give your oper
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!