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 variable used in a loop to control the number of times it is executed is called a _______.
tia_tia [17]

Answer:

the variable used in a loop to control the number of timer is executed is called a interaction.

Explanation:

a particular way in which matter, fields, and atomic and subatomic particles affect one another

6 0
3 years ago
If you want to wrap text so that it fits a particular cell size, which formatting section would you use?
Pavlova-9 [17]

You would use the formatting section of alignment.

7 0
3 years ago
Read 2 more answers
Assume we are using the simple model for floating-point representation as given in this book (the representation uses a 14-bit f
Artemon [7]

Answer:

The representation of 100.0 in the floating-point representation is computed as follows: First convert the given number 100.0 in the binary form. 10010 = 11001002 the binary representation.

Explanation:

3 0
2 years ago
The Internet has been around for quite a while, but it did not have much impact on our everyday lives until the appearance of th
pishuonlain [190]

Answer:

The answer is "WWW".

Explanation:

WWW stands for World Wide Web, It is a combination of all Internet resources and users, that uses the hypertext transfer protocol. It provides world information that is available on the internet that is the expression of human knowledge. It is also known as a domain name that introduces resources or individual instances of the entire collection.

6 0
3 years ago
33. (03.03 LC)
vodka [1.7K]

Answer:

False

Explanation:

Technology enhances the smooth run of businesses around the world at large. take an example of your transport systems, communication systems and even to advertisment of company products/services

5 0
3 years ago
Other questions:
  • PLEASE HELP ITS DRIVERS ED
    8·2 answers
  • Identify at least three body language messages that project a positive attitude?
    15·1 answer
  • How to make flashcards on microsoft word 2010?
    7·1 answer
  • An air-conditioning system's automatic controller might directly control the
    7·2 answers
  • Choose a film you have watched, or watch a film you have wanted to. Write a film review in at least three paragraphs. Describe w
    5·1 answer
  • A research team is studying parallel computing. They want to run parallel processes without having to use multiple processors. H
    15·2 answers
  • /*
    8·1 answer
  • A reasonable documentation comment for this program might be public class Questions1_4 { public static void main(String[ ] args)
    6·1 answer
  • Identify the following​
    9·1 answer
  • In 5-10 sentences, describe the procedure for responding to an e-mail message.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!