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.

Module A HW 1 Draft



Module A HW 1 Draft

Version: August 20th, 2025

This homework assignment focuses on 3 aspects of coding:

  1. Primitive Data Types

  2. Variables

  3. Built-in Functions


Part A: Variables

To get familiar with variables, we are going to create a profile that contains information about you through storing information through variables.

Question 1: Let's make our profile by assigning values to variables! For refreshers, you can look back on our lecture content.
# Fill out the ... part with your information.
# If you do not fill comfortable sharing your profile, you can make up a profile.

name = ...
age = ...
city = ...
state = ...

# These variables are checking whether you are a student/have a job right now, what data type would work best?
student = ...
job = ...
Question 2: Use the print() built-in function to output the values assigned to the variables.
Sample Output:
#Type your answer here

Part B: Data Type

Now let’s try to understand data types of these variables. For each question, assign your answer from the multiple choice in a string format.

    Example) What is a cat?
    1.   A feline species
    2.   A human
    3.   An alien

    answer = "1"
Question 3: What is the data type of `name`?
  1. Integers

  2. Floats

  3. Strings

  4. Booleans

  5. None

answer_3 = ...
Question 4: What is the data type of `age`?
  1. Integers

  2. Floats

  3. Strings

  4. Booleans

  5. None

answer_4 = ...
Question 5: List all the variables that are strings:
  • name

  • age

  • city

  • state

  • student

  • job

Type your answer here

Question 6: Where do you see yourself in 5 years? Let's create a profile of your future self.

To do this, fill in where you see yourself in 5 years into the new variables listed below.

five_year_later_local = ...
five_year_later_job = ...
Next, use the print() built-in function to output the values assigned to the variables.
Sample Output:
#Type your answer here

Part C: Arithmetic Operators

In python, we can use arithmetic operators to increase the value for age, meaning it isn’t necessary to create a new variable!

Make sure to use the previous variables from Question 1 in your updated profile print statement.

Question 7: Repeat question 6 but include your age after 5 years in the updated portion of your printed statement.
Sample Output:
#Type your answer here

Part D: Lists and Sorting

An integral part of python programming is utilizing lists to store information, whether it be numerical or categorical.

Question 8: You are having a garage sale, and you need to keep track of the clothes you have that need to be sold.

Create a list named clothes, which has the following items: shirts, pants, shorts, jackets, and hats

#Type your answer here
Question 9: Now, create anohter list called inventory which keeps track of just the number of each clothing item you have: 7 shirts, 4 pants, 2 shorts, 5 jackets, and 3 hats.
#Type your answer here
Question 9: How many total items of clothing are you selling?

Hint: Use the sum() function!

#Type your answer here
Question 10: Output the sorted inventory list using a built-in function.

(Sort the inventory list by name alphabetically)

#Type your answer here