Author: slothparadise

Introduction to Python – 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...


Introduction to Python – 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...


Introduction to Python – 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...


Introduction to Python – 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,...


Introduction to Python – 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...


Introduction to Python – 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...


nba_py documentation with examples

nba_py collects nba statistics from 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 cd nba_py sudo pip install . After you install nba_py, you can use the library by...


How to Access Ubuntu Bash Files from Windows

If you installed Bash on Windows 10, and you want to get access to the files that you created on Bash from the Windows side, here’s what you need to do! Open File Explorer Click File on the top left, click Change folder and search options Click on View tab, make sure Show hidden files, folders, and drives is selected, Click OK Click on the folder directory address box, copy and paste: %localappdata%\lxss or C:\Users\{username}\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu##.## When you click Enter, you’ll be...


How to Copy to System Clipboard from Vim

In this tutorial, I used Cygwin on Windows 10 and Bash on Windows 10 to copy text from vim to the system clipboard for pasting. Check if we have +clipboard on our version of vim If you’re using bash on Windows or Ubuntu, and vim does not have +clipboard, sudo apt-get install vim-gnome -y +clipboard gets installed vim file Type: :%y+ to copy all lines Right click and paste, and you’ll see the lines you copied from vim   Check if we have +clipboard on...


How to Script Interactive Programs or TUIs on Python with pexpect

If I had a interactive program or shell like bash, how do I automate and script what I want to do with Python? There’s a useful pip module called pexpect that you can install. The idea of pexpect originated from a programming language called Expect that automates interactions with programs that expose a text terminal like ftp, ssh, etc. Think of any program that opens a session that you have to exit! Prerequisites Python 2.7 or Python 3.3 or above pip install pexpect If...