Putting It All Together

Putting It All Together#

Q7: Describe the five data structures covered in this lab (strings, lists, dictionaries, tuples, sets) in your own words. How are they similar? What are key differences? What kinds of tasks/contexts/problems would benefit from specific structures?

  • NOTE: You are welcome to include code as part of this answer, but a code component is not required.

For these last two questions, you can use any of the data structures and arguments/syntax presented in this lab. As part of your answer, include a brief explanation for why you choose a particular data structure for the task.

Question 8#

Q8: Write a program that asks a user to input their current or former Notre Dame residence hall and returns or outputs that hall’s mascot (link to table with list of halls and mascots).

Sample output for this program:

Howard Hall's mascot is ducks!

Answer to this question includes program + comments that document process and explain your code, as well as a brief explanation for the data structure/approach you chose for this program.

Question 9#

Q9: In a previous lab, you wrote a program that asks the user to enter a color value and returns an output message indicating whether the color is a primary, secondary, or tertiary color (using a combination of the input() function, comparison operators, if-then-else logic, and Boolean logical operators).

Primary colors:

  • Red

  • Yellow

  • Blue

Secondary colors:

  • Green

  • Orange

  • Purple

Tertiary colors:

  • Amber

  • Vermillion

  • Magenta

  • Violet

  • Teal

  • Chartreuse

Let’s revisit and rewrite this program- how could you approach this task using the data structures and syntax presented in this lab?

Answer to this question includes program + comments that document process and explain your code, as well as a brief explanation for the data structure/approach you chose for this program.