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
balandron [24]
4 years ago
14

Python

Computers and Technology
1 answer:
Archy [21]4 years ago
3 0

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. Additionally create the code to run your function and print out the new string.

Explanation:

<u>CODE :</u>

import sys

import random

character= sys.argv[1]

count= int(sys.argv[2])

def generateString('char', count):

 random = char * count

 return random

print(character*count)

<u>OUTPUT :</u>

  • String('a' , 7)
  • aaaaaaa

In the above code, you are accepting a character, and a count value to go with it. When the value is updated, character is multiplied with the count, and the output is generated accordingly

You might be interested in
Fill in the boxes to show two ways you can find 8+6​
ludmilkaskok [199]

Answer:

8+6

6+8

Explanation:

8 0
3 years ago
Set numMatches to the number of elements in userValues (having NUM_VALS elements) that equal matchValue. Ex: If matchValue = 2 a
xenn [34]

Answer:

import java.util.Scanner;

public class FindMatchValue {

public static void main (String [] args) {

   final int NUM_VALS = 4;

   int[] userValues = new int[NUM_VALS];

   int i = 0;

   int matchValue = 0;

   int numMatches = -99; // Assign numMatches with 0 before your for loop

   userValues[0] = 2;

   userValues[1] = 2;

   userValues[2] = 1;

   userValues[3] = 2;

   matchValue = 2;

   numMatches=0;

   for(i=0;i<NUM_VALS;i++)

   {

       if(userValues[i]==matchValue)//cheking if the array element is equal to match value.

       {

           numMatches++;

           

       }

   }

   System.out.println(numMatches);//printing the matchvalue.

}

}

Output:-

3

Explanation:

First I have set the value numMatches to 0 before the loop.Then I have user the for loop to iterate over the array.In the for loop I am checking that the array element is equal to the matchValue or not if it is equal then increasing the numMatches by 1.Then at last print the value of numMatches.

5 0
3 years ago
Explain: The decode part of fetch decode execute cycle
egoroff_w [7]

Answer:

Image below

Explanation:

5 0
3 years ago
Read 2 more answers
Premiere Pro CS4 is the first version to be optimized for _______operating systems, although it is not natively 64-bit.
blondinia [14]
64-bit, according to the product description, and other sources.


7 0
3 years ago
ASAP!!!!!!!
Sidana [21]
A .2:)())...........\\
5 0
3 years ago
Read 2 more answers
Other questions:
  • What is a organisation in office technology
    7·1 answer
  • Will a pair of bar magnet ,with keepers on the two ends, act as a magnet
    13·1 answer
  • What is nominal data?
    5·1 answer
  • Motorcyclist might make an adjustment in speed when encountering ?
    7·2 answers
  • If you hear that an airplane crashes into the Empire State Building, and you immediately think of the 9/11 terrorist attack on t
    9·1 answer
  • A Unit of information containing the objects position, rotation, and scale values is called:
    13·1 answer
  • What are the characteristics of calendar sharing options in Outlook 2016? Check all that apply.
    13·2 answers
  • Project: Big Data Programming - Section 2
    11·1 answer
  • A Chain of dry-cleaning outlets wants to improve its operations by using data from devices at individual locations to make real-
    14·1 answer
  • What is the purpose of secondary<br> memory?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!