Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 810 Bytes

File metadata and controls

37 lines (26 loc) · 810 Bytes

Do Now 2.04

1. In your console

Type in the following:

    a_list = ['a', 'b', 'c', 'd', 'e']
    print(len(a_list))

In your notebook

Answer the following:

  1. What type do you think a_list is? (Hint: look at the variable name.)
  2. What does len do?
  3. Brainstorm how you would print the first element from a_list.

2. In your notebook, predict what will happen when the program below is run.

In your console, type the following:

    a_list = ['a', 'b', 'c', 'd', 'e']
    print(a_list[0])
    print(a_list[1])
    print(a_list[2])
    print(a_list[3])
    print(a_list[4])
    print(a_list[5])
    print(a_list[6])

Continue in your notebook.

Describe what happened when the program was run. Were there any differences from your predictions?