Each of the following problems asks you to count two things. The last lines printed should look like:
count: 23 count: 42
For simplicity, we will just use the word "count" for both lines in the output. The starter code includes lines to set variables
count2 to zero before the loop. As usual, you can print and count some cases by hand to check your code before submit time.
Do more baby names start with "A" or "B"? Write code to count and print those two counts ("A" count, then "B" count).
Now we'll look at the survey data. How many people identified "Modern Family" vs. "Game of Thrones" as their favorite TV show? The appropriate field in the survey is "tv". Write code to count and print those two values ("Modern Family" count, then "Game of Thrones" count).
Instead of looking at the whole survey, let's look only at the people who identified "blue" as their favorite color (the most popular choice). How many of them ("blue" rows) identified "coke" or "sprite" as their favorite soda? The appropriate fields in the survey are "color" and "soda". Write code to count and print those two values ("coke" count, then "sprite" count), among the blue.
This button will retrieve the code that has been run/saved from this page. Generally you retrieve your code all at once from a "homework" page, but this button is an alternative to retrieve your code for a particular exercise.
count 3 : table-5-ex1 table-5-ex2 table-5-ex3