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
sweet [91]
3 years ago
10

Write a function silence (typecode, length) that returns a new data array containing all zeros of the given type code and length

.
python programming
Computers and Technology
1 answer:
lions [1.4K]3 years ago
7 0

Answer:

Following are the code to this question:

import array as a#import package array  

def silence(typecode, length):#defining method silence that accepts two parameters  

   Val= a.array(typecode, [0]*length)#defining Val variable that stores zeros of the given type code and length

   return Val# use return keyword for return Val variable value

typecode = input('Enter typecode value: ')#use input method for input

length = int(input('Enter length value: '))#defining length variable that input integer value

print(*(silence(typecode, length)))#use print method to call silence method

Output:

Enter typecode value: b

Enter length value: 10

0 0 0 0 0 0 0 0 0 0

Explanation:

description of the code:

  • In the above-given Python code, Firstly we import a package that is the array, after that a method "silence" is defined that accepts two variables in its parameter that is "typecode and length".
  • Inside the method, the "Val" variable is declared, which is used to calculate and store all zeros of the typecode and length variable.
  • Outside the method, "typecode and length variable" is used for input the value from the user end-use the print method to call the function "silence" with an asterisk.
You might be interested in
Interactive sites where users write personal topics and comments to a threadded discussion are called?
Eddi Din [679]
The correct answer would be Forums
5 0
3 years ago
MLB The Show 17, which simulates professional baseball games, and Madden Football, which simulates professional football games,
insens350 [35]

Answer:

Sports game

Explanation:

5 0
3 years ago
What can be designed to create annoying glitches or destroy data
Katen [24]

I guess the best answer is Virus.

Virus is a malicious computer program that is designed to create annoying glitches or destroy data.

3 0
3 years ago
Read 2 more answers
What does a for loop look for in the sequence of data? Check all that apply.
ValentinkaMS [17]

Answer:

All

Explanation:

Not sure on the context of this question, but a loop is generally used to iterate though every piece of data to perform some kind of operation, on everything in something like an array or string.

7 0
3 years ago
Read 2 more answers
A Uniform Resource Locator (URL) consists of three separate parts: network protocol, host, and web browser.
FrozenT [24]
That is false. are you doing it on a computer course.                                             <span />
3 0
3 years ago
Read 2 more answers
Other questions:
  • Write a program that allows a user to input words at the command line. Your program should stop accepting words when the user en
    10·1 answer
  • Does anybody know how to use these showers?
    11·2 answers
  • Technologies designed to replace operating systems and services when they fail are called what?
    15·1 answer
  • Analog signals consists of individual electric pulses that represents bits group together into bytes {True/False}
    13·1 answer
  • There are several reasons it’s important to use the right tool and the right size tool for the job, but the most important reaso
    8·1 answer
  • Which industry has the highest employment figure for both teen and young adults in July, 2014?
    6·1 answer
  • What is one of the first power tools you’ll need as electrician
    15·1 answer
  • According to which virtue do you need to secure information by limiting computer access to authorized personnel only?
    6·1 answer
  • A game developer is purchasing a computing device to develop a game and recognizes the game engine software will require a devic
    7·1 answer
  • Questic
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!