# 8.14. Chapter Assessment¶

`rainfall_mi` is a string that contains the average number of inches of rainfall in Michigan for every month (in inches) with every month separated by a comma. Write code to compute the number of months that have more than 3 inches of rainfall. Store the result in the variable `num_rainy_months`. In other words, count the number of items with values `> 3.0`.

The variable `sentence` stores a string. Write code to determine how many words in `sentence` start and end with the same letter, including one-letter words. Store the result in the variable `same_letter_count`.

Write code to count the number of strings in list `items` that have the character `w` in it. Assign that number to the variable `acc_num`.

HINT 1: Use the accumulation pattern!

HINT 2: the `in` operator checks whether a substring is present in a string.

Write code that counts the number of words in `sentence` that contain either an “a” or an “e”. Store the result in the variable `num_a_or_e`.

Note 1: be sure to not double-count words that contain both an a and an e.

HINT 1: Use the `in` operator.

HINT 2: You can either use `or` or `elif`.

Write code that will count the number of vowels in the sentence `s` and assign the result to the variable `num_vowels`. For this problem, vowels are only a, e, i, o, and u. Hint: use the `in` operator with `vowels`.

Create one conditional so that if “Friendly” is in `w`, then “Friendly is here!” should be assigned to the variable `wrd`. If it’s not, check if “Friend” is in `w`. If so, the string “Friend is here!” should be assigned to the variable `wrd`, otherwise “No variation of friend is in here.” should be assigned to the variable `wrd`. (Also consider: does the order of your conditional statements matter for this problem? Why?)

We have written conditionals for you to use. Create the variable x and assign it some integer so that at the end of the code, `output` will be assigned the string `"Consistently working"`.

Write code so that if `"STATS 250"` is in the list `schedule`, then the string `"You could be in Information Science!"` is assigned to the variable `resp`. Otherwise, the string `"That's too bad."` should be assigned to the variable `resp`.

Create the variable `z` whose value is `30`. Write code to see if `z` is greater than `y`. If so, add 5 to `y`’s value, otherwise do nothing. Then, multiply `z` and `y`, and assign the resulting value to the variable `x`.

For each string in `wrd_lst`, find the number of characters in the string. If the number of characters is less than 6, add 1 to `accum` so that in the end, `accum` will contain an integer representing the total number of words in the list that have fewer than 6 characters.