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 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.
This code has a semantic error. Notice in the CodeLens image above that the output states the user is underage. Without changing the values of the variables, select the portion of the code that needs to change.
Prime numbers are numbers greater than 1 that only have two factors, 1 and the number itself. Notice that in order to reach line 14, line 12 must evaluate to true. Walk through the code to determine what is happening here and what the value will be when line 12 becomes true.