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
The person or persons requesting the worksheet should supply their requirements in a _____ document
ziro4ka [17]
<span>The person or persons requesting the worksheet should supply their requirements in a requirements document. </span>
3 0
3 years ago
Which word or phrase refers to an increasingly common method of computing and storing files?
Alecsey [184]
The answer is Cloud computing
Hope this helps-
3 0
3 years ago
Read 2 more answers
6. How can you encrypt an entire drive, including files and folders belonging to other users? a. EFS b. User Account Control c.
matrenka [14]

Answer:

A.

Explanation:

Encrypting File System (EFS) is a file system which enables you to encrypt files, thus making them unviewable by any account but your own.

6 0
3 years ago
The physical parts or components of a computer system is called .
dmitriy555 [2]
Answer:
Motherboard

Explanation:
Motherboard is the main component of a computer. It connects with other parts of the computer including drive disks, RAM and CPU and any other expansion slots :)

(Hope it helped)
4 0
3 years ago
Se tiene un pilar de hormigón de 30 cm de lado y 5 m de altura. Presenta una densidad de 2400 kg/m3 y una resistencia a la compr
kakasveta [241]

Answer:

El pilar no podrá soportar una masa de 10 toneladas

Explanation:

La dimensión del pilar de hormigón se da de la siguiente manera;

La longitud del lado, s = 30 cm = 0,3 m

La altura del pilar, h = 5 m

La densidad del pilar, ρ = 2,400 kg / m³

La resistencia a la compresión del pilar, σ = 500 kg / m²

El área de la sección transversal del pilar, A = s² = 0.3 m × 0.3 m = 0.09 m²

La masa del pilar, m = ρ × A × h = 2,400 × 0.09 × 5 = 1,080

La masa del pilar, m = 1.080 kg

Tenemos;

\sigma = \dfrac{F}{A}

Dónde;

F = La carga aplicada

A = El área de la sección transversal

∴ F = A × σ

F = 0,09 m² × 500 kg / m² = 45 kg

Por tanto, la carga que el pilar puede soportar sin compresión = 45 kg <10 toneladas = 9.071,847 kg

El pilar no podrá soportar una masa de 10 toneladas.

6 0
2 years ago
Other questions:
  • What's the code?
    6·1 answer
  • Rubbing two sticks together to make a fire is an example what
    11·2 answers
  • In Online Data Extraction data is extracteddirectly from the ------ system itself.o Hosto Destinationo Sourceo Terminal
    15·1 answer
  • Convert 578.2 into hexadecimal​
    9·1 answer
  • In a linked chain implementation of a queue, the performance of the enqueue operation
    14·1 answer
  • Nog
    8·1 answer
  • What do you mean by real time system? Why real time system needs to response within limited time?
    6·1 answer
  • 71 81 77 15 63 96 36 51 77 18 17
    14·1 answer
  • Giving brainliest if you answer question.
    8·1 answer
  • A company is looking for an employee to help organize customer information for the sales team. Which computer field includes thi
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!