Exercise

Create, index, and slice a tuple

You've seen that one of the major differences between a tuple and other data structures, such as a vector is the immutability of the tuple. The creation of a tuple is very similar to that of a vector, and indexing and slicing will also be familiar to you, using the square bracket notation.

In this exercise, you will create, index, and slice a tuple that you will call emergency_information. This tuple should contain the three fields that you identified in the previous question as good data to store in a tuple.

To create a tuple, remember that you need to use parentheses () to contain the values you wish to store in the tuple.

To index and slice a tuple, use the square bracket [] notation after the name of the tuple. Indexing starts at 1 for the first element in Julia.

Instructions 1/3

undefined XP
    1
    2
    3
  • Create a tuple called emergency_information that contains the:
    • birth_date 1990-05-24
    • birth_location Los Angeles
    • blood_type O+