This homework is worth 90 points total toward your overall homework grade (each part is 30 points), and is due Thursday, March 2, 2017 at 11:59:59 pm. There are three parts to the homework, each to be submitted separately. All parts should be submitted by the deadline or your program will be considered late.
The homework submission server URL is below for your convenience:
https://submitty.cs.rpi.edu/index.php?semester=s17&course=csci1100
Your programs for each part for this homework should be named:
hw4Part1.py
hw4Part2.py
hw4Part3.py
respectively. Each should be submitted separately.
See the handout for Homework 3 for discussion of grading and for a discussion of what is considered excess collaboration. These rules will be in force for the rest of the semester.
Final note, you will need to use loops in this assignment. We will leave the choice of loop type to you. Please feel free to use while loops or for loops depending on the task and your personal preference.
Part 1: Words with alternating vowels and consonants
Write a program that reads in words entered by the user and checks whether:
• the word has at least 8 characters,
• starts with a consonant,
• has alternating consonants and vowels, and
• the consonants are in decreasing alphabetical order.
The program should loop reading additional words until the user enters an empty string.
Note that you can check letters for alphabetical order using <.
For example:
>>> 'a' > 'b' False
>>> 'z' > 'b' True
https://submitty.cs.rpi.edu/index.php?semester=s17&course=csci1100
Your program should work for words entered upper or lower case, and must use a function is_alternating(word) that returns True if the word has the above pattern, and False otherwise. You are welcome to use additional functions if you would like. Hint. Remember to write a loop that goes through each letter and check for the necessary conditions. Using indexing is important here as you need to compare letters in different positions. Here is an example run of this program:
Enter a word: zayexiwo
The word 'zayexiwo' is alternating
Enter a word: zaYexiWov
The word 'zaYexiWov' is alternating
Enter a word: zaaexiWov
The word 'zaaexiWov' is not alternating
Enter a word: zYYexiWov
The word 'zYYexiWov' is not alternating
Enter a word: zayexiwx
The word 'zayexiwx' is not alternating
Enter a word: zayexiw
The word 'zayexiw' is not alternating
Enter a word: azayexiw
The word 'azayexiw' is not alternating
Enter a word: zazexiwo
The word 'zazexiwo' is not alternating
Enter a word:
And using real words,
Enter a word: remolade
The word 'remolade' is alternating
Enter a word: zucchini
The word 'zucchini' is not alternating
Enter a word: serenade
The word 'serenade' is alternating
Enter a word: topologic
The word 'topologic' is alternating
Enter a word: zodiacal
The word 'zodiacal' is not alternating
Enter a word:
Here is a little hint that will help: Given a letter stored in the variable x, the boolean expression:
x in 'aeiou'
is True if and only if x is a lower case vowel.
When you have tested your code, please submit it as hw4Part1.py. Be sure you use the correct filename, otherwise, Submitty will not be able to grade your submission.
Part 2: New York State Death Statistics
As part of an open government initiative, New York State releases a large number of health related statistics for researchers and developers to use. Among these are death statistics by region of the state at https://health.data.ny.gov. For this assignment, we have simplified the statistics to provide just the total number of deaths per 100,000 people. Our goal is to come up with a simple visualization comparing death trends between two different counties over the last few years.
Write a program to read in the death statistics for two different areas of NYS for the 11 years from 2003 to 2013. Remember that these are deaths per 100,000 people. We will take the naive view that areas with decreasing trends per 100,000 are automatically healthier places to live, ignoring all other population demographics such as age. For the two areas chosen, compute a trend for the death rates composed of the symbols =, +, and -, where = implies the year is within +/- 5 deaths per 100,000 of the previous year, + implies the year has more than 5 more deaths than the previous year, and and - implies that the year has more than 5 fewer deaths than the previous year. Starting from 2004, compute the trend for that year as compared to 2003 and encode it in the trend. Then move on to 2005, 2006 and etc. until you reach 2013. Your trend will run from 2004 through 2013. Print the trend