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

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...

More

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...

More

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...

More

Is the HoloLens Development Edition Worth Buying?

Microsoft HoloLens Dev Edition recently became available in several additional countries. I’ve been using the HoloLens since August 2016. It’s still a development edition, but is the HoloLens Dev Edition worth buying? Is it worth 3000 dollars? I’m going to focus on my opinions on its usability to best inform you about the device as it is today. I’m not undermining the great advances and craftsmanship of the device, but I’d like to focus on one thing that I especially...

More

sudo as root X11 connection rejected because of wrong authentication

I received this problem recently when I logged into root on a machine. X11 connection rejected because of wrong authentication How did this problem happen? Here’s what I did. ssh -X huyle@host sudo su xclock X11 connection rejected because of wrong authentication If I open xclock as a user, then X11 works just fine. As a result, I know that the server and client’s X11 forwarding is working. A root problem My .Xauthority and X11 credentials aren’t being passed over to root. ssh...

More