Implement a set of functions called getData, extractValues, and calcRatios. Function getData should prompt the user to enter pairs of integers, two per line, with each pair read as a single string, for example,
Enter integer pair (hit Enter to quit):
134 289 (read as \"134 289\")
etc.
These strings should be passed one at a time as they are being read to function extractValue, which is designed to return the string as a tuple of two integer values,
extractValues(\"134 289\") returns (134, 289)
etc.
Finally, each of these tuples is passed to function calcRatios one at a time to calculate and return the ratio of the two values. For example,
calcRatios( (134, 289) ) returns 0.46366782006920415
etc.
Implement a complete program that displays a list of ratios for an entered series of integer value pairs.Make sure to include docstring specifi cation for each of the functions.
No comments:
Post a Comment