Question

In: Computer Science

Objective: The purpose of this assignment is to introduce declaration of list objects, the forstatement and...

Objective: The purpose of this assignment is to introduce declaration of list objects, the forstatement and the def keyword used to define functions.

Problem: Write a Python module (a text file containing valid Python code) named p3.py. This file will contain the following.

  •  Definition of a list containing strings which are in turn integers. These integers represent years, which will be used as inputs to the next item in the file

  •  Definition of a function named isLeap. This function must accept a string containing an integer that will be interpreted by this function as a year. If the year is prior to the introduction of the Gregorian calendar, it will print “Not Gregorian.” If the year is aGregorian year and a leap year, it will print “Leap year!”. If the year is a Gregorian year butnot a leap year, it will print “Not a leap year!”.

  •  A for loop that will call isLeap with each of the year strings in the list of year strings defined above.

    While you are free to use any name for your list of year strings, you must use the name isLeap for the function.

    Submission: Submit the code you write in a text file named p3.py to the Blackboard folder for this assignment.

    Also –

    As you implement the code for this assignment, consider what might be added to the testing process and program output to make it clearer what the unit testing is accomplishing. For up to five points extra credit, you also submit a Word document describing any improvements you think would help in testing the function you created, including any additional output that would be useful or testing cycles.

Solutions

Expert Solution

Here i have Written  the code in python text file and save the file as p3.py

After saving the file now open a new python notebook

Now run the file using the codde %run p3.py

You can try in different ways :

BY wrtting the code in the python promt as text file and run the code


Related Solutions

IN JAVA Minimal Documentation Required (no javadoc) Purpose The purpose of this assignment is to introduce...
IN JAVA Minimal Documentation Required (no javadoc) Purpose The purpose of this assignment is to introduce you to basic operations on a linked list. Specifics Design a program that generates a linked list of randomly generated Integer objects. Present a menu at program start that gives the user the following options (most of these options will have corresponding methods in a Linked List class): 1. Create a new list. The size will be specified by the user, make sure a...
The Brain Game The purpose of this assignment is to introduce you to the well-known scientific...
The Brain Game The purpose of this assignment is to introduce you to the well-known scientific fact that humans do not make decisions rationally. Most of the time, decisions are made without people even realizing the “why” behind their decisions. Our decisions are often driven by our own biases instead of logic or good judgement. These numerous “poor instincts” are called cognitive biases. It is important to identify cognitive biases in Personal Finance because they cause so many of the...
Objective: The purpose of this programming assignment is to practice using STL containers. This problem is...
Objective: The purpose of this programming assignment is to practice using STL containers. This problem is selected from the online contest problem archive (Links to an external site.), which is used mostly by college students world wide to challenge their programming ability and to prepare themselves for attending programming contests such as the prestige ACM International Collegiate Programming Contest (Links to an external site.). For your convenience, I copied the description of the problem below with my note on the...
Objective: The purpose of this assignment is to test student skills to determine functional and non-functional...
Objective: The purpose of this assignment is to test student skills to determine functional and non-functional requirements for ticket-issuing system. An automated ticket-issuing system sells rail tickets. The system is secured enough because only authenticated users are able to access. The system is developed with high performance speed and storage. Users select their destination and input a credit card and a personal identification number. The rail ticket is issued and their credit card account charged. When the user presses the...
Law Library Reading and Assignment Purpose: To introduce you to the law library system, various resources...
Law Library Reading and Assignment Purpose: To introduce you to the law library system, various resources available and the importance to legal staff (attorneys, paralegals, and legal assistants, etc.) Outcome: You will be able to demonstrate general knowledge of legal references and resource material commonly found in law offices/law libraries. Assignment - Questions What are the four categories of law? What are the three classes of law? Describe the three types of library organization Describe how a court form can...
Purpose of Assignment  The purpose of this assignment is to allow the students to understand and...
Purpose of Assignment  The purpose of this assignment is to allow the students to understand and practice the measurement of present value, future value, and interest rate using Microsoft® Excel®.  Assignment Steps  Resources: Microsoft® Office® 2013 Accessibility Tutorials, Microsoft® Excel®, Time Value of Money Calculations Template Calculate the following time value of money problems using Microsoft® Excel®: If we place $8,592.00 in a savings account paying 7.5 percent interest compounded annually, how much will our account accrue to in 9.5 years? What is the present value of...
Purpose of Assignment The purpose of this assignment is to allow the students to become familiar...
Purpose of Assignment The purpose of this assignment is to allow the students to become familiar with and practice the measurement of Net Present Value (NPV), payback, and Weighted Average Cost of Capital (WACC) using Microsoft® Excel®. Assignment Steps Resources: Microsoft® Excel®, Capital Budgeting Decision Models Template Calculate the following problems using Microsoft® Excel®: Calculate the NPV for each project and determine which project should be accepted. Project A Project B Project C Project D Inital Outlay (105,000.000) (99,000.00) (110,000.00)...
Rate of Return for Stocks and Bonds Purpose of Assignment The purpose of this assignment is...
Rate of Return for Stocks and Bonds Purpose of Assignment The purpose of this assignment is to allow the student an opportunity to calculate the rate of return of equity and debt instruments. It allows the student to understand the effects of dividends; capital gains; inflation rates; and how the nominal rate of return affects valuation and pricing. The assignment also allows the student to apply concepts related to CAPM, WACC, and Flotation Costs to understand the influence of debt...
Purpose of Assignment The purpose of this assignment is to allow students the opportunity to research...
Purpose of Assignment The purpose of this assignment is to allow students the opportunity to research a Fortune 500 company stock using the popular online research tool, Yahoo Finance. The tool allows the student to review analyst reports and other key financial information necessary to evaluate the stock value and make an educated decision on whether to invest. Assignment Steps Select a Fortune 500 company from one of the following industries: Pharmaceutical Energy Retail Automotive Computer Hardware Manufacturing Mining Review...
What is purpose of an objective tree and how it is developed ? provide the objective...
What is purpose of an objective tree and how it is developed ? provide the objective tree for a portable Wireless EEG (Electroencephalogram) device that can be used for medical and non-medical applications.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT