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
ludmilkaskok [199]
3 years ago
11

Create a function generateString(char, val) that returns a string with val number of char characters concatenated together. For

example generateString('a', 7) will return aaaaaaa.
Computers and Technology
2 answers:
Grace [21]3 years ago
8 0

Answer:

The solution code is written in Python.

  1. def generateString(char, val):
  2.    output = ""
  3.    for i in range(val):
  4.        output += char
  5.    
  6.    return output  
  7. print(generateString('a', 7))

Explanation:

Firstly, let's create a function <em>generateString()</em> that take two input arguments, <em>char</em> and<em> val.</em>

To generate a string with <em>val </em>number of <em>char</em>, we need a string variable, <em>output,</em> to hold the string value. Let's initialize the <em>output</em> with an empty string (Line 2)

Next, we can create a for loop that will repeat the loop for <em>val</em> number of time (using the <em>range() </em>method) and keep adding the same <em>char</em> to the <em>output</em> string (Line 5).

At last return the <em>output</em> string (Line 7).

WARRIOR [948]3 years ago
5 0

I have write a very simple code for you in python and i hope it will help you a lot.


def generateString(char, val):

   print(char * val)

Explanation:

This is how you can create your function in python and this function will give you the desired output.


How to Call a function:

generateString('a',12)

this is how you can call the function to get output.

I hope you get the idea.



You might be interested in
"what do you perform when you want to recall specific records from a database"
Ivan
A select query


select column1, column2, columnN
from table
where condition
order to be pretty;
5 0
3 years ago
_____ is the unauthorized entry into a computer system via any means
Montano1993 [528]
Hi,

The word you are looking for is "Hacking".

"Hacking is unauthorized entry into a computer system via any means."

Hope this helps.
r3t40
4 0
3 years ago
Which of the following is an example of a tax?
Alik [6]
Medicare because it’s like insurance
5 0
2 years ago
A hardware supplier manufactures three kinds of​ clamps, types​ A, B, and C. Production restrictions force it to make 10 more ty
Rufina [12.5K]

Answer:

A = 120

B = 40

C = 70

Solution:

As per the question:

Manufacturer forced to make 10 more type C clamps than the total of A and b:

10 + A + B = C                (1)

Also, 3 times as many type B as type A clamps are:

A = 3B                             (2)

The total no. of clamps produced per day:

A + B + C  = 330              (3)

The no. of each type manufactured per day:

Now, from eqn (1), and (3):

A + B + 10 + A + B = 330

2A + 2B = 320

A + B = 160                       (4)

Now, from eqn (2) and (4):

3B + B = 160

B = 40

Since, A = 3B

A = 3\times 40

A = 120          

Put the values of A and C in eqn (3):

120 + 40 + C = 330

C = 70

4 0
3 years ago
Write a JavaScript program to generate the following pattern but the number of rows should be user input.
Nookie1986 [14]

Answer:

Testicles

Explanation:

u sukkk

3 0
3 years ago
Other questions:
  • A dropped packet is often referred to as a _____________.
    7·1 answer
  • MATLAB graphics user interface:<br> Describe what Folder, Command Window and Workspace are.
    5·1 answer
  • The FTC found CardSystems Solutions and its predecessors __________ the FTC Act 15, U.S.
    12·1 answer
  • Which of the following represents inbound logistics for a bookstore
    13·1 answer
  • The inside color of text or of an object is called the:
    12·1 answer
  • Every character is represented by a code. The ASCII code for upper letter A is 65 and for lower a is 97. Similarly the numeric c
    9·1 answer
  • There is usually a positive side and a negative side to each technology improvement. Select a technology you use every day and c
    5·1 answer
  • What does my name look like in binary code, btw my mane is Wendy Alexis Morales
    10·2 answers
  • In order to organize your work effectively on the computer, where is the best place to save it?
    14·2 answers
  • Which cable would you check if you can't access any web pages?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!