Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Application

How to Submit

Your answers to this chapter’s application questions should be added to the notebook template.

Submit the Colab link on Canvas for the assignment submission.

Application Questions

Q1: Write a program that converts integer, float, or boolean values to a string, using the str() function.

Q2: Write a program that prompts the user to enter a 6-letter word, and then prints the first, third, and fifth letters of that word.

Q3: Modify the program provided below to search for the character q or u in the string. Does it always return the index number you expect? What index is returned if you ask for the index of the letter u (i.e., what happens when the desired character appears more than once in the string)?

Q4: Write a program that creates a list of numbers. Use the arguments and syntax presented in this section of the chapter to include code in your program that answers the following questions:

Answer to this question includes program + comments that document process and explain your code.

Q5: Modify your Q4 program (working with the same list), using arguments and syntax covered in this section of the chapter to accomplish the following tasks:

Answer to this question includes program + comments that document process and explain your code.

Q6: Write a program that creates a dictionary on a topic of your choosing. Include at least 5 key-value pairs. Use arguments and syntax covered in this section of the chapter to accomplish the following tasks:

Answer to this question includes program + comments that document process and explain your code.

Q7: Describe the five data structures covered in this chapter (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?

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.

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.

Q9: In a previous chapter, 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:

Secondary colors:

Tertiary colors:

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.