Homework #3

Due: Thursday, February 22, 2018 at 11:59 p.m.Points: 100

Please turn in your answers for the homework assignment on Canvas under Homework #3 in Assignments.

(40 points) A string is said to be abcdearian if the letters in it, regardless of case, are in dictionary order. So, for example, “almost” and “effort” are abcdearian, and “willow” and “computer” are not.

Write a recursive function called isabcde(s) that returns True if s contains a string that is abcdearian, and False otherwise. The function must ignore any non-letter characters in s, and treat all alphabetic characters as lower case. Note the function must be recursive, and so must call itself.

Write a program that reads a string and uses the function to determine whether the string is abcdearian. The program is to loop until the user types an end of file (control-D), or another exception occurs.
Here is sample output:

The string? heLlo↵
heLlo is not abcdearian
The string? aLmost↵
aLmost is abcdearian
The string? w3i$l0l!ow↵
w3i$l0l!ow is not abcdearian
The string? e3f$f0o!rt↵
e3f$f0o!rt is abcdearian
The string? cOmpuTer↵
cOmpuTer is not abcdearian
The string? ABcDE↵
ABcDE is abcdearian
The string? control-D

(60 points) The file data_hw_3 contains lines with 3 columns separated by a space representing the volume of air inspired and expired. The first column is the breath number (BN); the second column is the volume of air inspired, in ml; and the third column of air is the volume of air expired.

Write a program that computes the average, standard deviation, maximum difference between air inspired and expired for each breath, and the minimum difference between air inspired and air expired for each breath. Your output should look like this (but with the correct numbers; the ones here are wrong):

Average volume of air inspired is 120.15 ml with a standard deviation of 328.90
Average volume of air expired is 121.82 ml with a standard deviation of 561.20
The maximum difference between air inspired and expired is 289
The minimum difference between air inspired and expired is 5