Question

In: Computer Science

Functions also introduce the concept of modularity, where a program can be broken up into multiple...

Functions also introduce the concept of modularity, where a program can be broken up into multiple smaller pieces; each of these modules contains one or more functions that can be used to perform a small part of the overall task (and which can be reused by other programs). Python includes a large library of modules, each of which includes useful pre- written functions that programmers can use in their own programs with the use of an import statement.

1. Identify the name of the module and briefly summarize what general purpose it serves.


2. Select THREE functions from this module. List each function’s name and briefly describe what it does.


3. Give an example of a type of program (real or hypothetical) for which this module is either essential or extremely useful.


Solutions

Expert Solution

>>Answer

>.Given

The two other modules from the list on the "Python Standard Library" page are:

1. datetime:

Name of the module: datetime module

General purpose: This module supplies classes which contains information about date and time objects. It is used to manipulate dates and times.

Three functions:

datetime.now( ): It gives current date and time.
date.today( ): It gives the current date.
date.fromtimestamp(timestamp): This method converts timestamp into date.
Example: All the information (files) in a computer system from the moment it has been created is stored in the system along with its timestamp, date and time. When this data needs to be manipulated by developers, datetime module will be an absolute necessity.

2. cmath:

Name of the module: cmath module

General purpose: When dealing with complex numbers or floating point numbers, this module has all the useful methods to manipulate such types of numbers as arguements.

Three functions:

cmath.phase(x): This returns the phase of x as a float.It is basically one of the ways to convert rectangualr coordinates to polar coordinates.
cmath.exp(x): It retuens e to the power of x, where e is base of natural logarithms.
cmath.sqrt(x): It gives the square root of x.
Example: With cmath python module, the half-life of an unkown radioactive element by measuring the mass at an interval.


Related Solutions

Functions also introduce the concept of modularity, where a program can be broken up into multiple...
Functions also introduce the concept of modularity, where a program can be broken up into multiple smaller pieces; each of these modules contains one or more functions that can be used to perform a small part of the overall task (and which can be reused by other programs). Python includes a large library of modules, each of which includes useful pre- written functions that programmers can use in their own programs with the use of an import statement. The “Python...
2 multiple choice Questions 1. Which of the following best describes the concept of enhancer modularity?...
2 multiple choice Questions 1. Which of the following best describes the concept of enhancer modularity?     a.   Multiple genes to a genome     b.   None of the other options     c.   Multiple transcription factors bind to an enhancer     d.   Multiple enhancers for a gene 2. is it true or false Mesenchymal stem cells generally have a greater range of potential cell types than other adult stem cells.
In addition to the way we phrase questions, the method of surveying can also introduce bias....
In addition to the way we phrase questions, the method of surveying can also introduce bias. What are some potential biases that could occur when using the following survey techniques? - In-person - Mail - Phone - E-mail - Text - Social Media Please make sure you consider—among other things—how expensive each method is, the outreach potential, response time, and response rate.
Write a program using multiple functions. Make use of an array to store data Make use...
Write a program using multiple functions. Make use of an array to store data Make use of searching techniques Read data from a file Write data to a file Instructions: In this lab, you will be examining a set of stock collected over a twenty four day period. Be sure to make use of an array to store these stocks. You will be required to read in the data points from a file. Write a function to read in the...
can someone explain the concept of proactive and reactive in accounting? also if GAAP a proactive...
can someone explain the concept of proactive and reactive in accounting? also if GAAP a proactive way ? or reactive ?
Split the main function given into multiple functions. You have been given a very simple program...
Split the main function given into multiple functions. You have been given a very simple program that performs basic operations (addition, subtraction, editing) on two randomly generated integer vectors. All functionality has been included in main, causing code segments to be repeated as well as diminishing the readability. Rewrite the program by grouping calculations and related operations into functions. In particular, your program should include the following functions. InitializeVectors: This is a void function that initializes the two vectors by...
Mutation is seen as defective form/functions of living things. But it can also allow us to...
Mutation is seen as defective form/functions of living things. But it can also allow us to learn/experience/explore from it. a. What is genetic mutation? b. What causes mutations? c. Describe some common chromosomal mutation and discuss why are mutations so important to living organisms.
in python You will be writing a program that can be used to sum up and...
in python You will be writing a program that can be used to sum up and report lab scores. Your program must allow a user to enter points values for the four parts of the problem solving process (0-5 points for each step), the code (0-20 points), and 3 partner ratings (0-10) points each. It should sum the points for each problem-solving step, the code, and the average of the three partner ratings and print out a string reporting the...
Give an example where there is a possibility of moral hazard. Also discuss how can the...
Give an example where there is a possibility of moral hazard. Also discuss how can the possibility of moral hazard be addressed?
create a C++ program where you have 2 functions with two parameters. Limit the first function...
create a C++ program where you have 2 functions with two parameters. Limit the first function allowed input to values of numbers from 1-10 and from 5 to 20 for the second function. have each function add their two-parameter together then add the functions final values together. Show error message if wrong input is entered   Ask the user if they wish to continue the program (use loop or decision for this question).
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT