In Class Exercise: Introduction to Python, Variables, and Lists
The following exercises will have you create a set of variables, formulas, and list in Python. For this exercise, open the in-class workbook, make a copy, and follow the instructions.
You can find the In Class Exercise here:
Be sure to rename the workbook something like "(Your_Name)_Class_Introduction_to_Python_Variables_Lists.ipynb".
Instructions
After opening the workbook, follow the instructions in the workbook to complete the exercises. There are two parts to this exercise. Part 1 will go over the basics of Python and variables. Part 2 will give you practice with the basics of Lists in Python.
For Part 2, here is a list of common list methods you will be using:
| Method | Description |
|---|---|
| append() | Adds an element to the end of the list. |
| extend() | Adds all elements of a list to the end of the list. |
| insert() | Inserts an element at the specified position. |
| remove() | Removes the first item with the specified value. |
| pop() | Removes the element at the specified position. |
| clear() | Removes all items from the list. |
| index() | Returns the index of the first element with the specified value. |
| count() | Returns the number of elements with the specified value. |
| sort() | Sorts the list. |
| reverse() | Reverses the order of the list. |
| len() | Returns the length of items in a sequence or collection. |
Note
The len() method and count() method are both similar, but they are not the same. The len() method returns the number of items in a list, while the count() method returns the number of times a specific item appears in a list.
Turning in/Rubric
REMINDER - For this class, you will only turn in the links to your colab notebooks. You will get a 0 for this assignment if you turn in a python file or a link that is not correct, wrong assignment, or does not give editor permission.
Rubric:
| Item | Points Possible |
|---|---|
Total |
5 |
The following is not a part of the rubric, but specifies how you can lose points. For example: if you fail to share your link correctly.
| Reasons for Points Lost | Amount |
|---|---|
| Link shared incorrectly | -10% |
| Turned in late (per week) | -10% (up to -50%) |