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]
4 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]4 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
System software includes all of the following except
Amanda [17]

Answer:

System software includes all of the following except <u>Browsers</u>.

Explanation:

I just know

4 0
3 years ago
which two host names follow the guidelines for naming conventions on cisco ios devices? (choose two.)
vlabodo [156]

RM-3-Switch-2A4* and SwBranch799* are the two host names follow the guidelines for naming conventions on cisco ios devices. The correct options are 2 and 3.

<h3>What is a host name?</h3>

A hostname is a label assigned to a computer network connected device that is used to identify the device in various forms of electronic communication, such as the World Wide Web.

Hostnames can be simple single-word or phrase names, or they can be structured.

The two host names, RM-3-Switch-2A4 and SwBranch799, adhere to the guidelines for naming conventions on Cisco iOS devices.

Thus, the correct options are 2 and 3.

For more details regarding host name, visit:

brainly.com/question/13267319

#SPJ1

Your question seems incomplete, the missing part is attached below:

7 0
2 years ago
5.23 LAB: Contains the character
torisob [31]

Answer:

In C++:

#include<iostream>

#include<vector>

using namespace std;

int main() {

int len;

cout<<"Length: ";  cin>>len;

string inpt;

vector<string> vect;

for(int i =0;i<len;i++){

  cin>>inpt;

  vect.push_back(inpt); }

char ch;

cout<<"Input char: ";  cin>>ch;  

for(int i =0;i<len;i++){

  size_t found = vect.at(i).find(ch);  

      if (found != string::npos){

          cout<<vect.at(i)<<" ";

          i++;

      }

}  

return 0;

}

Explanation:

This declares the length of vector as integer

int len;

This prompts the user for length

cout<<"Length: ";  cin>>len;

This declares input as string

string inpt;

This declares string vector

vector<string> vect;

The following iteration gets input into the vector

for(int i =0;i<len;i++){

  cin>>inpt;

  vect.push_back(inpt); }

This declares ch as character

char ch;

This prompts the user for character

cout<<"Input char: ";  cin>>ch;  

The following iterates through the vector

for(int i =0;i<len;i++){

This checks if vector element contains the character

  size_t found = vect.at(i).find(ch);  

If found:

      if (found != string::npos){

Print out the vector element

          cout<<vect.at(i)<<" ";

And move to the next vector element

          i++;

      }

}  

7 0
2 years ago
What e-mail protocol does Marina and Rita’s Cupcakes use and why is it important?
Taya2010 [7]

Marina and Rita’s Cupcakes use the IMAP email protocol. It is important since it stores copies of all the emails stored on the server.

 

To add, IMAP<span> (Internet Message Access Protocol) is a standard email protocol that stores email messages on a mail server, but allows the end user to view and manipulate the messages,</span>

8 0
4 years ago
Are there any output differences between floats and doubles?
lana [24]

Explanation:

The precision in double values is twice as compared to float values.Hence double have smaller rounding errors as compared to float variables .A double is of 64 bits and float is of 32 bits usually hence floats have more rounding errors and on more number than doubles.Double has 15 decimal digits of precision and float has only 7 decimal digits for precision.

5 0
3 years ago
Other questions:
  • Sam has been asked to classify a number of different processing systems that his consultancy's client uses.
    9·1 answer
  • Web maintenance plays a vital role in a website's development. It helps ensure the online presence of any website by performing
    8·1 answer
  • What causes air pollution in your community?
    13·1 answer
  • Controls that are used to assess whether anything went wrong, such as unauthorized access attempts, are called ________ controls
    5·2 answers
  • When typing a cell, hitting Tab will bring which result?
    12·1 answer
  • Llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
    7·1 answer
  • A website requires their users to create a password for their own account using numbers from 0-5, inclusive, non-repeatedly. The
    7·2 answers
  • Actors,narratirs,and other people whi appear in video programs collectively called what?
    15·1 answer
  • Choose the correct climate association for: deciduous forest
    10·1 answer
  • The Bellman-Ford algorithm for the shortest path problem with negative edge weights will report that there exists a negative cyc
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!