Category Archives: Python

How to Loop over a List in Python

Lists are cool, and one of the first things you’re going to want to do is loop over a list. The  diagram below that breaks down how each part of this type of loop works: Now, this type of loop is called a foreach loop, and it’s a straightforward way to gain access to each element in the list. Let’s … Continue reading How to Loop over a List in Python →

What is DeMorgan’s Law in Programming? [ Answered with pics]

Demorgan’s Law is something that any student of programming eventually needs to deal with. Just tell me the “formula”, ok : [crayon-5ecdceb27da99424225911-i/] is equivalent to [crayon-5ecdceb27daa2284440781-i/] [crayon-5ecdceb27daa6672750245-i/] is equivalent to [crayon-5ecdceb27daaa582892594-i/] Demorgan’s Law via Animation and Programming Code First, let’s set up the problem and then look at how we wold write the code (and then we’ll see … Continue...

What’s an elif in Python? [Answered with vids and gifs]

In short,  an “elif”  means “else  if”.. If you’ve used other programming languages, you’re probalby used to writing [crayon-5ecdceb27ea1f325132948-i/]  or [crayon-5ecdceb27ea27693852442-i/] , but python contracts that to the single word [crayon-5ecdceb27ea2b269696511-i/]  .   The video below, from our middle school cu rriculum for teaching kids python, explains how to use an elif     If  you’re not a video … Continue read...