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
Wanna play pubg<br><br><br>ill send u my id​
Nikitich [7]
My sister would what’s your id
6 0
3 years ago
Read 2 more answers
Your help desk has informed you that they received an urgent call from the vice president last night requesting his logon ID and
makkiz [27]

Answer:

Social Engineering Attack

Explanation:

The exploitation of individuals in order to gain confedential information is a Social Engineering Attack. These attacks typically take advanage of one's emotions or they use inpersonaltion to steal data.

read more here: https://www.webroot.com/us/en/resources/tips-articles/what-is-social-engineering

Lmk if this helps! :)

7 0
3 years ago
TRUE OR FALSE!!!!!
VladimirAG [237]
The answer is True.
6 0
3 years ago
Read 2 more answers
What is PCM system? essay
brilliants [131]

A PCM system consists of a PCM encoder (transmitter) and a PCM decoder (receiver). The essential operations in the PCM transmitter are sampling, quantizing and encoding. All the operations are usually performed in the same circuit called as analog-to digital convert Early electrical communications started to sample signals in order to multiplex samples from multiple telegraphy sources and to convey them over a single telegraph cable. The American inventor Moses G. Farmer conveyed telegraph time-division multiplexing (TDM) as early as 1853. Electrical engineer W. M. Miner, in 1903, used an electro-mechanical commutator for time-division multiplexing multiple telegraph signals; he also applied this technology to telephony.

7 0
3 years ago
You want to upgrade a server by installing an external SCSI tape drive. The system currently has a SCSI card and an internal SCS
jeka94

Answer:

You should disable termination on the Small Computer System Interface (SCSI) controller card.

Explanation:

SCSI is an acronym for Small Computer System Interface, which is also generally referred to as host bus adapter (HBA). The SCSI is typically a chip that controls the communication between the operating system (OS), storage devices such as hard disk drives and the host computer system. Also, it helps with the interpretation of the electrical signals between the Small Computer System Interface (SCSI) bus and the input-output bus for storage devices.

In this scenario, you want to upgrade a server by installing an external SCSI tape drive. The system currently has a Small Computer System Interface (SCSI) card and an internal SCSI hard drive. At bootup, the system fails to recognize the new tape drive. To solve this problem, you should disable termination on the SCSI controller card so that only the external SCSI tape drive will be active and the SCSI won't be detected.

6 0
3 years ago
Other questions:
  • What procedures are involved in saving a file for the first time?
    10·2 answers
  • 6. Which of the following is malware? (1 point)
    15·2 answers
  • If a computer is capable only of manipulating and storing integers, what di themselves? How are these difficulties overcome
    13·1 answer
  • COMPUTER SCIENCE:PIXELS
    5·1 answer
  • the technique of blocking some parts of a photograph to emphasize (or draw attention to) another part of the same photograph is
    8·1 answer
  • Which type of operating system is usually used in personal computers
    13·1 answer
  • Please fill these out. I really need this done.
    5·1 answer
  • What is one reason why a business may want to move entirely online?
    13·1 answer
  • Beneficios del reciclaje electrónico
    6·1 answer
  • 1. Discuss the pros and cons of human-computer interaction technology?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!