Question

In: Computer Science

Modularity Note: The documentation you’ll be looking at for this part of the lab was written...

Modularity

Note: The documentation you’ll be looking at for this part of the lab was written for

professional programmers, not programming novices, so it may include a number of

references to complex technical topics or details. Don’t be surprised, discouraged, or

concerned if parts of it don’t make a lot of sense right now; much of it will become clearer

as the semester progresses. For now, just do the best you can to look for information that

you can use to answer the question(s) below.

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 Standard Library” Web page, available at <https://

docs.python.org/3/library/index.html>, contains a full list of these “bundled” modules (the

list starts at the “Text Processing Services” bullet point and continues until the end of the

page).

In class to date, we’ve used or made reference to three of these modules: random,

string, and math. Choose TWO of the other modules listed on the “Python Standard

Library” page. For each module:

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

Calender

this module can be used to output a calender and do a lot of additional processes and calculations related to a calender, dates, months,year  etc.It can output an editable calender in HTML.

isleap() - method is used to return True if year is a leap year, otherwise False.

HTMLCalender(firstweekday=0) - this method can be used to print a calender in html

calender.monthcalender( TheYear, TheMonth)- Returns a matrix representing a month’s calendar. Each row represents a week, days outside of the month are represented by zeros.

This module will be helpful while creating a program for schedule organizer, or to display a time table, where a calender is a crucial part of the application.

Random

This module is used to generate pseudo random numbers

seed()- intializes a random number generator

randrange() - outputs a random number in the given range

sample() - outputs a random element from a given sequence

This module will be helpful while creating a game that involves use of dice, like snake and ladder , ludo to generate a random number from 1 to 6 as an output of the dice.


Related Solutions

Binary Search Tree (Part 1): Note: This is the first part of a 2-part lab. Only...
Binary Search Tree (Part 1): Note: This is the first part of a 2-part lab. Only this part is due on Oct 29. But please get it working or you will struggle with the second part. For the second part, the data type will be changing. For now, it is a string. Contents Explanation: 2 BST.cpp: 2 Code you must write: 2 bool insert(string s) (7): 2 TNode *find(string s) (4): 2 void printTreeIO(Tnode *n)(3): 2 void printTreePre(Tnode *n) (3):...
Note: This is a single file C++ project - No documentation is required on this assignment....
Note: This is a single file C++ project - No documentation is required on this assignment. Write a Fraction class whose objects will represent Fractions. Note: You should not simplify (reduce) fractions, you should not use "const," and all of your code should be in a single file. In this single file, the class declaration will come first, followed by the definitions of the class member functions, followed by the client program. You must provide the following member functions: A...
Documentation is anything written or printed on which one relies as record or proof of patient...
Documentation is anything written or printed on which one relies as record or proof of patient actions and activities. In not less than two pages describe FIVE (5) guidelines for quality nursing documentation at the ward.
For this part of the project, you’ll collect data on various measure of confidence from the...
For this part of the project, you’ll collect data on various measure of confidence from the FRED website Figure 10 – University of Michigan: Consumer Sentiment (UMCSENT), last year Figure 11 – S&P 500 (SP500), last year Figure 12 – St. Louis Fed Financial Stress Index (STLFSI), last year 1. In your own words, briefly describe what each of the three indices measure. Why are these considered an indicator of the economy’s “health”? 2. How have these indices changed over...
For this part of the project, you’ll collect data on various measure of confidence from the...
For this part of the project, you’ll collect data on various measure of confidence from the FRED website. University of Michigan: Consumer Sentiment (UMCSENT), last year S&P 500 (SP500), last year St. Louis Fed Financial Stress Index (STLFSI), last year 1. In your own words, briefly describe what each of the three indices measure. Why are these considered an indicator of the economy’s “health”? 2. How have these indices changed over the past year? Do you think consumers and firms...
9.25 LAB*: Program: Online shopping cart (Part 2) Note: Creating multiple Scanner objects for the same...
9.25 LAB*: Program: Online shopping cart (Part 2) Note: Creating multiple Scanner objects for the same input stream yields unexpected behavior. Thus, good practice is to use a single Scanner object for reading input from System.in. That Scanner object can be passed as an argument to any methods that read input. This program extends the earlier "Online shopping cart" program. (Consider first saving your earlier program). (1) Extend the ItemToPurchase class per the following specifications: Private fields string itemDescription -...
how to write Man Page documentation ? i have a group project written in C and...
how to write Man Page documentation ? i have a group project written in C and my job is to write man page documentstion. can anyone please explain it and how to write and please provide example. thank you
For this part of the project, you’ll collect data on real GDP and potential GDP measures...
For this part of the project, you’ll collect data on real GDP and potential GDP measures from the FRED website.   – Real GDP (GDPC1) AND Real Potential GDP (GDPPOT), 2007 – current year After that, answer all these questions. 1. What is the conceptual difference between real GDP and potential GDP? In terms of the economy using their resources, what does it mean if real GDP is less than potential GDP? What does it mean if real GDP is greater...
which of the following is not part of the documentation for claiming the reasonable cause exception...
which of the following is not part of the documentation for claiming the reasonable cause exception from a penalty for substanial valuation misstatement due to an irc 482 adjustment? A. basic transfer pricing analysis conducted by the taxpayer B. leaned treaties on transfer pricing theory C. background documents D. disclosure of the method used o a timely filed tax return
17.1 Lab Lesson 10 (Part 1 of 2) Part of lab lesson 10 There are two...
17.1 Lab Lesson 10 (Part 1 of 2) Part of lab lesson 10 There are two parts to lab lesson 10. The entire lab will be worth 100 points. Bonus points for lab lesson 10 There are also 10 bonus points. To earn the bonus points you have to complete the Participation Activities and Challenge Activities for zyBooks/zyLabs unit 16 (Gaddis Chapter 7). These have to be completed by the due date for lab lesson 10. For example, if you...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT