Intro to Python Cont…

Came back to python before going to other/new courses as I’m pretty confident python is going to be the hardest for me to learn. Stay tuned on that.

Started today with review quizzes from the first 2 chapters of this course. They were on python basics and python lists. Got a 1/5 and a 4/5. I would say my biggest take away from today is to understand the different functions and what they mean. I think that’s where I slipped up on the python basics quiz. You can find the functions here: https://docs.python.org/3/library/functions.html#print.

To finish off the intro to python course, the next two chapters were Functions and Packages & NumPy. There were some challenges with these two chapters but overall they went well. For now at least…I’ll see when I take a quiz on them tomorrow.

Functions and packages:

  1. The main theme of the functions this chapter went over is that functions can ‘write’ the code for you. For example, the max( ) function. This, of course, will return the max value of a list. You can also assign the max function a name. Ex: tallest = max(fam)*. Now if you print(tallest), that will return the height of the tallest member in the ‘fam’ list

    1. *fam is the built in list data camp provides in the course which has heights

  2. There is a massive list of functions (see link above), and I only know a couple as of now, so I won’t go over everything this course did but the above example is essentially the same across the board. The different functions will just calculate different formals based on what is being called

  3. NumPy. In short, NumPy is a package in python that makes doing calculations easier from what I currently understand. You have to import NumPy into python which is typically imported like this: ‘import numpy as np’. From there, you’re off to the races!

    1. The main thing the NumPy chapter went over was making calculations on lists. So, we used data from the ‘MLB’ on players heights, weights, and ages. First step was taking measurements of player heights and changing them from inches to meters. This allows you to change the entire list using a simple formula

    2. One thing to note about NumPy, you can’t use different types in the same list. For example, if you have integers (whole numbers) & boolean’s (True/False) types, the result will turn ‘True’ into 1 and ‘False’ into 0 defaulting to the integers

    3. Subsetting with. NumPy works the same as before

      1. list [18, 9, 10]

      2. print(2) will return the 10 in the above list. First value in a list is 0 remember. This caused me to get some questions and work wrong which I had to go back and fix.

    4. NumPy also has functions. np.mean, np.std, np.median, etc.

      1. These all return values of the mean, standard deviation, median, etc. of a list.

Intro to python, complete. On the python skill track, I have intermediate python upcoming. We’ll see how that goes.

Day 5, over.

-TJ

Previous
Previous

Intro to R

Next
Next

Intro to Python