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...
1 Objective The purpose of this assignment is to test your familiarity with Java I/O, and...
1 Objective The purpose of this assignment is to test your familiarity with Java I/O, and if-else statements. Please submit your file as ”Shipping.java” 2 The Backstory Amazon.com wants to try out it’s new ‘Delivery by Drone” service and has recruited you to write a Java console application to calculate the shipping cost. They are going to charge the customer based on various criteria, as shown below: Weight (in kg) Rate per 50 miles 2 or less Over 2 Kg,...
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: To write an application using the list data structure that sorts objects in ascending order....
Purpose: To write an application using the list data structure that sorts objects in ascending order. Details: Create a class called Rectangle containing the following: Two instance variables, An instance variable of type double used to hold the rectangle’s width. An instance variable of type double used to hold the rectangle’s height. Provide a constructor with two parameters used to initializes each instance variable. The constructor should verify that the specified width and height values are greater than 0.0 and...
Assignment 4: Objects that contain objects In this assignment, you will implement a Java application, called...
Assignment 4: Objects that contain objects In this assignment, you will implement a Java application, called BankApplication, that can be used to manage bank accounts. The application is to be implemented using three classes, called Account, Customer, and BankDriver. The description of these classes is below. Problem Description class Account The Account class keeps track of the balance in a bank account with a varying annual interest rate. The Account class is identified as follows: • two double instance variables,...
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...
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