[Tutor] New to Python
jsmallwood82 at yahoo.com
Sun Apr 27 00:53:33 CEST 2014
I am new to Python. I mean completely new and we're working on this problem set in class where they give us specs and we have to build something based off these specs. I have no idea what they're asking. Could someone help get me started on the path to figuring this out?
Below is the question:
1. Write a program module with at least two functions. Follow this specifi- cation exactly for these two functions:
1. (a) One function, CalculateCentimeters, receives a value in inches and returns the equivalent value in centimeters.
2. (b) The other function, CalculateInches receives a value in centime-
ters and returns the equivalent value in inches. inches =centimeters/2.54
... but you don’t 2.54 in your code 2 times. It’s a good candidate to be a module-level constant.
Specified instructions about the internals of code, i.e., the names of your functions and how they behave, is called theinternal specification. It tells you, the author of the function, as well as programmers who call your function, how to call it and what to expect when it is called. You must following them exactly or call a meeting of your programming team because your choices here affect the others.
For this exercise, you design the rest of the functions for your program, but be careful to keep all the code in functions.
Invent and arrange functions as you wish to ask the user for:
(a) a value
(b) a unit of measure
and call the appropriate function to print out the value in the other unit of measure.
Specified instructions about the user’s view of your code (like just given) is called the external specification. Often the paying customer gives these directions so you must follow them exactly, doing things in the order given; but in this case, the internal design is up to you.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor