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
What should you use as the argument for the goto() command?
Soloha48 [4]
D. The X and Y coordinates of a point 

goto(21,60)

will make the turtle go to that specific location.
7 0
3 years ago
What is an audit trail?
rewona [7]

Answer:

poop

Explanation:

poop

3 0
3 years ago
Read 2 more answers
How do you fix this windows 7 screen​
tensa zangetsu [6.8K]

Try restarting it. If you can’t restart because the screen is frozen maybe just turn it off and back on. If you already tried restarting and it still didn’t fix the problem, just give it some time. The computer will reset itself eventually which should fix the problem.

6 0
3 years ago
Mention five importance of taskbar​
sveticcg [70]

Answer:

The taskbar is an element of an operating system located at the bottom of the screen. It allows you to locate and launch programs through Start and the Start menu, or view any program that's currently open.

6 0
3 years ago
Consider the following algorithms. Each algorithm operates on a list containing n elements, where n is a very large integer.
DochEvi [55]

We have that the appropriate statement will be

  • An algorithm that accesses only the first 10 elements in the list, regardless of the size of the list. Which of the algorithms run in reasonable time

III only.

Option B

From the question we are told

Consider the following <u>algorithms</u>. Each <u>algorithm</u> operates on a list containing n <em>elements</em>, where n is a very large <u>integer</u>.

I. An algorithm that accesses each <u>element</u> in the list twice.

II. An <em>algorithm </em>that accesses each <u>element </u>in the list n times.

III. An <u>algorithm</u> that accesses only the first 10 elements in the list, regardless of the size of the list. Which of the <em>algorithms </em>run in <em>reasonable </em>time?

<h3>Algorithm  </h3>

Generally In order to get <em>admission </em>to every thing in the list twice, the algorithm has to traverse the listing twice,

which leads to 2*n entry to operations.

And if the every factor is accessed n times, the listing will be traversed n time, which leads to n^2 get right of entry to operations.

If n is a very giant <em>integer</em>, each 2*n and n^2 are plenty larger.

So, there will be <em>solely </em>ten entry to operations and this algorithm will have a sensible jogging time.

Therefore

An algorithm that accesses only the first 10 elements in the list, regardless of the size of the list. Which of the algorithms run in reasonable time

III only.

Option B

For more information on  algorithm  visit

brainly.com/question/950632

4 0
2 years ago
Other questions:
  • A _______ is conducted to determine the adequacy of system controls, ensure compliance with established security policy and proc
    10·1 answer
  • Write a method for the Customer class that that will return a string representing a bill notice when passed a double value repre
    14·1 answer
  • The data in a database management system that identifies the names of​ tables, fields in each​ table, and the properties of each
    13·2 answers
  • #include #include int main( ) { int value = 10; int pid; value += 5; pid = fork( ); if (pid &gt; 0 ) { value += 20; } printf(val
    10·1 answer
  • Who was the founder of the location-sharing site Whrrl
    6·1 answer
  • You want to make the background of a Web page blue, click _____.
    13·2 answers
  • A circuit breaker will do which of the following
    12·1 answer
  • Can someone help me with this pls
    5·2 answers
  • Write the function evens which takes in a queue by reference and changes it to only contain the even elements. That is, if the q
    6·1 answer
  • What does this mean? And how did I get it?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!