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
When both gears are the same size what will they produce
djverab [1.8K]

They produce a 1:1 ratio.  The input power is equal to the output power.

7 0
4 years ago
The sticky notes often have strings of characters written on them that appear to be passwords. What can you do to prevent the se
Varvara68 [4.7K]
Educate the user on how to make strong passwords
8 0
2 years ago
A student has completed some work at school and wishes to take it home. He could use a pen
photoshop1234 [79]

Answer:

what is that I don't understand I am from china

6 0
3 years ago
2. What is the layout of the modern keyboard known as?
lukranit [14]

Answer: QWERTY

Explanation:

QWERTY is a keyboard design for Latin-script alphabets. The name comes from the order of the first six keys on the top left letter row of the keyboard ( Q W E R T Y )

6 0
3 years ago
Which of these is the function of a modeler?
Liono4ka [1.6K]

Answer:

Create 3D assets from sketches

Explanation:

A modeler Job is to model all of the 3D/2D assets needed to obtain the final result wanted by the developers. The modeler creates the assets from sketches or images provided to him according to the theme.

5 0
3 years ago
Read 2 more answers
Other questions:
  • Why should you use a named constant for the size of an array?
    9·1 answer
  • Most modern TCP implementations use pseudo-random number generators (PRNG) to determine starting sequence numbers for TCP sessio
    13·1 answer
  • Which projects would Word be best used for? Check all that apply. understanding words
    10·1 answer
  • Why information technology is important in healthcare?
    13·1 answer
  • With his assembly lines, Henry Ford improved what process? A. computer management B. just-in-time management C. Bessemer process
    5·1 answer
  • A tool in Word that creates multiple copies of the same letter, envelope, or label and inserts personalized data is a(n) _____.
    12·1 answer
  • When you are cut off in traffic by another driver and you respond by “flipping him the bird,” you are using a type of gesture ca
    7·1 answer
  • Select the statement which most accurately describes the benefits and drawbacks of working from home and telecommuting.
    13·2 answers
  • Write a program that displays the average temperature and the annual precipitation for a selected city. The user should be able
    10·1 answer
  • Select examples of software
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!