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]
4 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]4 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]4 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
Write the code to create a variable score and assign it the value 0?​
Galina-37 [17]

Answer:

You can assign a value to a routine variable in any of the following ways:

Use a LET statement.

Use a SELECT INTO statement.

Use a CALL statement with a procedure that has a RETURNING clause.

Use an EXECUTE PROCEDURE INTO or EXECUTE FUNCTION INTO statement.

Explanation:

4 0
3 years ago
Someone please help fast! I’m taking the test rn and I don’t understand this!!!!!!
andrezito [222]

Answer:

the mistake that was made by allen is that he was not suppose to hire a highly proficient technician to install the heating and cooling system in the granary.

7 0
3 years ago
Use the Windows ________ to check on a nonresponsive program. Select one: A. Backup utility B. Task Manager C. System Restore D.
Nitella [24]
The answer is task manager. You can access it by pressing the Windows key and searching "task manager". You can also press ctrl+alt+delete or ctrl+shift+esc to access it.

Taskanager will show you all the applications currently running and how many resources they are using. If a task is unresponsive, it can be force closed from task manager.
4 0
3 years ago
. SQL is a(n) _____ language.
Blababa [14]

Answer: Fourth- generation language

Explanation:Structured Query Language (SQL) is the language that is in the form of database structure which helps in the manipulation of the data and management as well.

SQL is considered as the fourth generation language because it is used for the accessing of the data from the database.It is also known for the advancement in the third generation language and thus also improving the language interface with users.

7 0
3 years ago
URGENT!!! Which statement is true with regard to bitmap images?
liberstina [14]

Answer:

<u><em>D. You can modify colors easily and quickly.</em></u>

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • The number of protons plus the number of nuetrons equal the <br> A.atomic weight<br> B.atomic number
    10·1 answer
  • The wired or wireless means of connecting a computer to the internet is called a ________.
    9·1 answer
  • If a domain consists of dcs that are running versions of windows server earlir than windows server 2008, what replication method
    12·1 answer
  • I was walking in the rain with my Tim’s on steeping over puddles full of pain
    7·2 answers
  • You are asked to add speech to a robotic receptionist that sits at the front desk of a large organization. The robot has an anim
    10·2 answers
  • 2. Driving above the posted speed limit is _
    13·2 answers
  • How do you change your name because i really would like to change but i am not sure how to could someone help with it please
    12·1 answer
  • Where is voice data stored in Android?
    11·1 answer
  • Which language is written using 0s and 1S​
    11·1 answer
  • True or False? Voice recognition is the process of determining the meaning of the words spoken by a human.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!