HIMT 345
Homework 05: Functions
Overview: Examine PyCharm’s “Introduction to Python” samples for
Functions. Use PyCharm to work along with exercises from Chapter 4.
Modify the grade assignment program of Hwk 04 to utilize a function
by copying the Hwk04 project and creating the Hwk05 project.
Prior Task Completion:
1. Read Chapter 04
2. View Chapter 04’s video notes.
3. As you view the video, work along with each code sample in
PyCharm. The examples used in the video are available for you to
experiment with if you downloaded the complete Severance source
files for Chapters 3-10.
a) With PyCharm open, locate the .zip file entitled Ch 4 Functions
PPT Code Samples.zip.
b) Open each of the project files for that chapter in PyCharm.
Note: The code samples are numbered in the order they are covered
in the video.
c) Start the video and follow along.
4. Complete Exercises 4.1 – 4.5 (not handed in).
Specifics: PyCharm’s “Introduction to Python” project contains
multiple examples giving the basics of conditional expressions (see
list at right). Follow the instructions to complete them. (Not
handed in.)
Use PyCharm to work along with the video solution for Exercise 4.6
from the textbook. Try to make the same mistakes (and fixes) made
by the author. (Not handed in.)
Create a copy of your Hwk04 project file, calling it Hwk05.
1. Highlight the Hwk04 project, select Refactor/Copy.
Important: Do not skip the process of following along with the
videos. It is a very important part of the learning process!
2. Give it a New name: of Hwk05 and leave the To directory: in its
default state.
Leave the “Open copy in editor” box checked.
3. After clicking OK, if the project fails to open, just open it
manually as you would
any project (File | Open | Hwk05 project).
You may immediately delete Hwk04b as it is not needed in this
assignment. You may
need to Refactor | Rename both the project name and the existing
Hwk04a.py file, as
only the directory was renamed by PyCharm in creating the
copy.
Having renamed Hwk04a to Hwk05_YourLastName.py, your task is to
determine the
letter grade using a function.
Here is some pseudocode* to guide the process:
(NOTE: The assign_grade function must be declared at the top of the
Python file.)
Prompt for the test score, using try-except to verify it is
valid
Invoke (call) the function, supplying it the test score and it
returning the appropriate
letter grade;
e.g. letter_grade = assign_grade(test_score)
Display the test score and appropriate letter grade.
What to hand in:
Take screen shots of the console window verifying correct handling
of bad input as well
as letter grades for one test score in each grade range. Copy the
screen shots into a
Word document (filename Hwk05_YourLastName_Screenshots.doc) with
your name and
date in the upper right hand corner. Upload the Word doc and the
Python program file
(Hwk05_YourLastName.py) to the appropriate assignment in the
LMS.
NOTE: As was described in the previous assignment, each Python file
you create should
be documented with (minimally) the following three lines at the top
of each file:
# Filename: Hwk03.py
# Author: <Your Name>
# Date Created: 2016/09/05
# Purpose: <brief description>
(*) pseudocode: a notation resembling a simplified programming
language, used in
program design.
In: Computer Science
A client at a software design company wants assistance processing their documents. After interviewing the client you find that their documents consist of a one sentence title, a date, and a series of paragraphs. Each paragraph is a simple list of sentences. Paragraphs are separated by new lines. Each document also has an author (first and last name) and a document access level (open, internal or confidential). At a minimal level the client would like the software to be able to: * Count the number of words in the document (with or without the title) * Count the number of characters in the document * Print out a document * Print out the date of the document * Print out the author of the document Additional desirable features: * Count the number of a particular type of word (noun, verb, proper noun or other) * Given a title, date, author and a string for the remaining document, create a document file * Spell check the document
In: Computer Science
1. Determine if the following describes a binomial experiment.
If not, give a reason why not:
Five cards are randomly selected with replacement from a standard
deck of playing cards, and the number of aces is recorded.
2. Determine if the following describes a binomial experiment.
If not, give a reason why not:
Two cards are randomly selected without replacement from a standard
deck of playing cards, and the number of kings (K) is recorded.
3. Determine if the following describes a binomial experiment.
If not, give a reason why not:
Toss a 6-sided die until a "2" is observed.
4. Determine if a Poisson experiment is described, and select
the best answer:
Suppose we knew that the average number of typos in our statistics
text was 0.08 per page. The author knows that he is much more
likely to make a typo on a page that has many mathematical symbols
or formulas compared to pages that contain only plain text. He
would like to know the probability that a randomly selected page
that contains only text will contain no typos.
In: Statistics and Probability
Internet Programming
Project #4: XML, Schema and XSLT
1. Write a complete XML file named textbooks.xml, in which you describe at least a partial list of the textbooks you are using this semester. You should include at least two distinct textbooks. If you are using only one text this semester, expand your list to cover the current academic year.
Your description of each book must include the title, author(s), publisher, year of publication, and the ISBN. For each author, specify the first and last name as distinct values. Include both a name and website for the publisher. Optionally, try also to include any book-specific website (especially if it is distinct from the main publisher site, and if its URL is not ridiculously long). Finally, specify the edition and cover type (paperback or hardcover) of each book you are using. Make sure your final XML document is well-formed.
2. Write an XML Schema that can be used to validate textbooks.xml and name it textbook.xsd . Finally, remember to modify your new XML document so that it references your schema.
3. Develop an XSL Stylesheet for easy viewing of your textbook list and name it textbook.xsl
In: Computer Science
In: Statistics and Probability
For each of the following descriptions: - Identify the degree and cardinalities of the relationship. - Draw the corresponding E-R diagram. Don’t forget the degree and cardinalities of each relationship.
1 . A book is identified by its ISBN number, and it has a title, a price, and a date of publication. It is written by one or multiple authors. Each author is identified by an author number and has a name and date of birth. Each author has either one or multiple books. Occasionally, it is possible that prospective authors who have not yet published any books.
2. The book described above can be part of a set, which is also identified as a book and has its own ISBN number. One book can belong to several sets, and a set consists of at least one but potentially many books
3. A piano manufacturer wants to keep track of all the pianos it makes individually. Each piano has an identifying serial number and a manufacturing completion date. Each piano represents exactly one piano model, all of which have an identification number and a name. The manufacturer usually produces several pianos from a single model and each model is used to make at least one piano. A piano model is created by a single designer. It is important for the manufacturer to maintain information about the designer name and identifying them using an identification number. Note that while a designer can send multiple model to the manufacturer, some of the designers stored in the database have not sent any model yet.
In: Operations Management
Consider the following schema:
Publisher (name, phone, city), PK: name.
Book (ISBN, title, year, published_by, previous_edition, price), PK: ISBN, FK: published_by refs Publisher, previous_edition refs Book.
Author (SSN, first_name, last_name, address, income), PK: SSN.
Write (aSSN, bISBN), PK: (aSSN, bISBN), FK: aSSN refs Author, bISBN refs Book.
Editor (SSN, first_name, last_name, address, salary, works_for, book_count), PK: SSN, FK: works_for refs Publisher.
Edit (eSSN, bISBN), PK: (eSSN, bISBN), FK: eSSN refs Editor, bISBN refs Book.
Author_Editor (aeSSN, hours), PK: aeSSN, FK: aeSSN refs Author, aeSSN refs Editor.
Give SQL statements for the following plain English language queries based on the above schema.
Hint: You may use views to hold intermediate results.
2. Provide an SQL UPDATE statement that updates the book_count field of the Editor table by computing the number of books edited by each editor using nested queries. (10 pts)
3. For each publisher, find the title of the book that it publishes with the largest number of editors. The output should have two columns - one is the publisher’ name and the other is the title of the book found.
In: Computer Science
Prove that (((p v ~q) ⊕ p) v ~p) ⊕ (p v ~q) ⊕ (p ⊕ q) is equivalent to p ^ q. Please show your work and name all the logical equivalence laws for each step. ( v = or, ~ = not, ⊕ = XOR)
Thank you
In: Computer Science
PLease answer the following about bias in cohort studies.
1.Prospective Cohort
a…What is a bias that this study design avoids?
b…What is a bias that this study design is less likely to have?
c…What kind of bias this study design mostprone to?
d…What kind of bias this study design prone to?
2.Retrospective Cohort
a…What is a bias that this study design avoids?
b…What is a bias that this study design is less likely to have?
c…What kind of bias this study design mostprone to?
d…What kind of bias this study design prone to?
In: Psychology
How do I use the meta element to sepicify your name as the document author and as kansas and elections as key words for web search engines?
How do I create semantic link in the document head linking this document to the office of the kansas secretary of state at the following address: ( http://www.kssos.org/elections_statistics.html ) use the property attribute value of external for the link.
In: Computer Science