Detailed docstring specification for the function

Assignment Help Python Programming
Reference no: EM132121111

Part I: The Assignment Files
One of the most important outcomes of this assignment is that you understand the importance of testing. This assignment will follow an iterative development cycle. That means you will write a few functions, then fully test them before you write any more. This process makes it easier to find bugs; you know that any bugs must have been part of the work you did since the last test.

Iterative development requires that you work on each of the files simultaneously. In particular, you will write some code in a1test.py, move to a1.py and then back to a1test.py. Therefore, to get you started we want you to first create all three files. You are not going to put (much) code in the files right now. We just want you to have the files created so that you have a starting point to work from.

The very first thing you should do is specifically create a directory for this assignment. This folder should contain the three assignment files and nothing else.

Part II: The Core Functions

Iterative Development

In this part of the assignment, you will work on the files a1.py and a1test.py. It is is broken into four parts (listed as Parts A, B, C, and D). In each part, you will do the following:

Write a function header into a1

We will give you the header to write. We will also give you a detailed docstring specification for the function. You should copy-and-paste the specification into the function body, indented.

Add test cases to a1test

Yes, this means you are writing tests before writing the function bodies. We talked about this in lecture.

Unless otherwise instructed, each test case should be a call to an assert function in the introcs module. Furthermore, your tests should be
representative. While we talked about this in class, you might be a little unsure of what we are asking for here. If so, you might want to go over
lab9 with a consultant before going any further.

Write the function bodies

Make sure that the function satisifies the specifications exactly. If the specification says to return something, you need a return statement. Make sure that the value returned is of the correct type.

Run the unit test a1test

If errors are found, fix them and re-test. Keep doing this until no more errors are found.

Function Specifications

The descriptions that we provide in each part below represent the level of completeness and precision we are looking for in your docstring comments. In fact, it is best to copy-and-paste these descriptions to create the first draft of your docstring comments. If you do not cut and paste, please adhere to the conventions we use, such as using a single line, followed by a blank line and a more descriptive paragraph, or by using "Returns: ..." for fruitful-functions. While we have provided the contents of the specification, we have not always formatted them properly for you.

Part III: The Application Script
You are essentially done. The last part of the assignment is to complete the file a1app.py. This file will be no more complicated than the script
die.py that you made for lab 5. In fact, it will have a similar number of lines.

At the top of the file a1app.py remember to add the line

import a1

This will allow you to access the exchange function in this script. This is the only function of a1.py that you will need to use. Everything else will be either an input function, a print function, or some other built-in function, just as you did in the lab.
We are not going to give you much more guidance than that. Use your file dice.py as a guide if you are unsure what to do. In this end, the script should prompt the user and provide an answer, as shown below.
[user@machine]:a1 > python a1app.py
3- letter code for original currency: USD 3-letter code for the new currency: EUR Amount of the original currency: 2.5
You can exchange 2.5 USD for 2.158923 EUR.

Obviously you will get different answers for different currencies and amounts. But otherwise, the output displayed must look exactly like it does above. You must use those exact words for your final print statement and end with a period.


Attachment:- cs assignment.rar

Reference no: EM132121111

Questions Cloud

How much time would be required for a setup : Hammond Inc. has analyzed the setup time on its computer-controlled lathe. The setup requires changing the type of fixture that holds a part.
What sorts of information would you expect to obtain : What sorts of information would you expect to obtain using each source? What might you use the information obtained from these sources for?
Is the can-spam law working : What actions, if any, have you taken to limit the permissions of the sender? Why or why not?
Determine the length that maximizes the volume : A rectangular box without a top has surface area 2500 cm2 . The length x of its base is 18 cm longer that its width.
Detailed docstring specification for the function : We will also give you a detailed docstring specification for the function. You should copy-and-paste the specification into the function body, indented
Produce three big data models using the ms powerpoint : You are required to produce three big data models using the MS PowerPoint software. This tool is available on UMUC Virtual Desktop Application (VDA)
Identify current required accountant skills : What and how does future technological innovation such as artificial intelligence and accounting software automation impact on accountant skills
Evaluating the performance of managers of the company : HI5020 Corporate Accounting - provide a comparative analysis of the two companies that you have selected explaining the insights that you can get from the compa
Calculate and store discounted price for all flights : Calculate and store discounted price for all flights - The flight number and price must be entered from the keyboard and a validation for minimum and maximum

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd