Worksheet 1#
For this worksheet only, to get full points, you must work in a group of 2-3 students. Each student must submit the finished worksheet on Canvas.
This worksheet is due Tuesday of Week 2, by 11:59pm. (Worksheet 2 is due at the same time.)
Instructions to create a workspace for your group#
One group member should create a workspace for the group using the following instructions.
Click on the workspace name “Math 10 S23” at the top left, then click the “+” icon next to your name.
Choose the “Free” plan if you are asked to choose a plan.
Give your workspace a name, like “Worksheet 1 group”. Select the option “For a class (I’m a student)”.
Invite your groupmates, giving them “Editor” or “Admin” access.
Click on “Settings & members”, then “Upgrade”, then “Get free education plan”.
If you click on the … next to this
Worksheet 1
project, you should be able to duplicate it into your the new workspace you just created. Once you have this duplicate copy, you can edit it.
Names#
Names: (put the names of everyone in your group here in this markdown cell)
Python warm-up#
Here is a list of lists. (You need to execute the following code cell every time you start this notebook.)
mylist = [
[2, 4],
[3, 1],
[-2, 5],
[6.2, 4],
[1, 4]
]
Check the data type of
mylist
, usingtype
.
Check the length of
mylist
usinglen
.
What is the zero-th element of the inside list at index 3. (In Python, there is some ambiguity if I say the “third” element. I will try to consistently start counting at zero, so in this case, I would say the “third inside list” is the list
[6.2, 4]
. The answer to this question should be6.2
.)
Create a new object named
myarray
by convertingmylist
into a NumPy array. Use thenp.array
function to make this conversion. You will need to import NumPy.
Display
myarray
. (Just evaluate the name on its own line.)
Counting elements#
Don’t worry if this material is totally unfamiliar to you. We will discuss it during class on either Monday or during discussion section on Tuesday.
How many of the inside lists in
mylist
have last element equal to4
? Use afor
loop.
Overall question: How many of the elements in the last column of myarray are equal to 4? First, use
myarray[:, -1]
to access this last column. (We’ll answer the overall question below.)
Use
== 4
to create a Boolean array with entriesTrue
orFalse
corresponding to whether the elements in this column are4
or not.
Count how many of the elements in the last column of
myarray
are equal to4
by either using.sum()
at the end (and adding parentheses) or by wrapping the last expression likesum(???)
.
Markdown practice#
Make a markdown cell below this one. Find a dataset on Kaggle that you think looks interesting. Provide a link to that dataset using this format:
[text to display](URL)
. For example, the link to Kaggle I provided above was made using[Kaggle](https://www.kaggle.com/)
.Write just one or two sentences about what you think is interesting about this dataset.
Submission#
Using the
Share
button at the top right, enable public sharing, and enable Comment privileges. Then submit the created link on Canvas.