Category: Python

Introduction to Python and Computer Science – Chapter 9 – Dictionaries and Sets

In this video, we’ll talk about dictionaries and sets. For strings, lists, and tuples, we have been using integers as the indices and position numbers in order to get their values. Dictionaries are similar to lists except that instead of using integers as the indices, dictionaries can use any string or number or immutable type as the index. Let’s create a dictionary to demonstrate how it works. We will create a dictionary called states. Instead of using number indices, we...

More

Introduction to Python and Computer Science – Chapter 8 – Lists, Matrices, and Tuples

In the last video, we talked about lists. There are a couple of more things that we need to talk about lists including matrices. Let’s say that we had two lists:

With lists, a and b are the same thing. If I change b, then a is also changed. Let’s test changing b.

When we run the program, we can see that even though a was a list with 1, 2, 3, 4, and 5, and we didn’t...

More

Introduction to Python and Computer Science – Chapter 7 – Lists

In this video, we’ll talk about lists. List is the term used for an ordered sequence of values where each value has an index. Before we continue to talk about lists, there is also a term called arrays from other programming languages that you might have heard about. Arrays are almost exactly like lists in Python. There’s an array module in Python for using arrays. In Python, arrays can only hold data of the same type. Lists can hold multiple...

More

Introduction to Python and Computer Science – Chapter 6 – Strings and For Loops

In this video, we’ll talk more about strings and explain the for loop. A string is a data type created when we use a pair of quotation marks.

is an example of a string. Let’s say that I wanted to get the “m” character in “microwavesam”. A character is the term used for a single symbol in Python. In Python and programming languages, we also use the term, element. An element is a term for any individual part of...

More

Introduction to Python and Computer Science – Chapter 5 – Iteration and While Loops

We talked about recursion and iteration in the last tutorial. Recursion is the term used when you call the same function inside a function, which causes repetition since you’re repeating the function. Iteration is the term used when you repeat steps without using recursion. This video will be about making iteration or repeating steps easier! In tutorial #2, we talked about most recent assignment because we talked about how you can assign a variable multiple times. A variable takes the...

More

Introduction to Python and Computer Science – Chapter 4 – Return and Recursion

In this video, we’ll talk about return statements and recursion. In a previous video, we talked about how the value that you get from a function is the return value. If I call type(4), I get the return value of int. How does the type() function return the type int value? Let’s write a function that adds two numbers and returns the result the same way how the type() function gets a result.

Notice how the function uses the...

More

Introduction to Python and Computer Science – Chapter 3 – Conditionals

In this video, we’ll talk about more operators you can use, conditionals, and recursion. We’ve talked about the basic operators in the previous videos. Operators like plus, minus, multiply, and division. A very commonly used operator is modulus or also called modulo. What’s modulus? Modulus works on integers and finds the remainder when dividing two numbers. The modulus operator is the percent sign (%). For example,

Think of dividing 7 by 3, but what gets returned is the remainder,...

More

Introduction to Python and Computer Science – Chapter 2 – Types and Functions

This video will expand on the basic concepts that we talked about in the previous video. In the first video, we talked about a terminology called assignment. x = 5 is an assignment. You assign values to variables. A variable can be assigned many times, and it always keeps the value of its most recent assignment. If I do, x = 7, it replaces x = 5. You can do x = x + 1, which adds 1 to its...

More

Introduction to Python and Computer Science – Chapter 1 – Intro and Variables

Intro Computer Science is not the study of computers nor is it only about programming. Sometimes, when people hear about Computer Science, they think oh, computers and programming! In reality, computers are just a tool in computer science, and programming simply executes a sequence of instructions that we create. Computer Science is all about computation, asking the question: “What exactly can be computed, how can we compute it, and how fast we can compute it?” Computation is a fancy way...

More

nba_py documentation with examples

nba_py collects nba statistics from stats.nba.com. This page will provide documentation on the endpoints and example data that nba_py can get because nba stats api documentation is very minimal. nba_py also does have documentation, but it’s more about the parameters of functions that you can do without examples of what return data you may get. How to install nba_py Get pip git clone https://github.com/seemethere/nba_py cd nba_py sudo pip install . After you install nba_py, you can use the library by...

More