Category Archive

Begin Python

The 12 Days of Christmas… or any countdown song

Posted on December 15, 2016 by alanysiu

Loops are a big part of programming, because one of the benefits of programs is that they can automate repetitive tasks for humans. If we were to type out the complete lyrics to “The 12 Days of Christmas,” we would end up having to do a lot of typing! And it wouldn’t be fun typing—it would be boring, repetitive typing. What about if you were to tell someone the lyrics to “The 12 Days of Christmas”? How would you describe it without repeating yourself? That’s pretty much how this program works. So if I were to describe in English how


Generating a random passphrase

Posted on December 8, 2016 by alanysiu

Disclaimer I’m not going to go into all the politics of passwords. Users are always trying to balance security with convenience. The point of this tutorial is not to say “This is how you generate the best password.” It’s more like “If you want to generate a random passphrase, this is one way to do it in Python.” The passwords you generate with this won’t be stuff like 6ZFtK!’z[^R88Rgd, but they also won’t be password or 123456. Creating and running the file Open up your text editor and save the empty text file as on your desktop. In the


Making a Rock, Paper, Scissors game in Python

Posted on November 29, 2016 by alanysiu

Before you code, figure out what you’re trying to do with the code A brief note on codeUsing comments in code Expanding shorthand logic Considering another approach No one right way to approach problems Let’s actually start writing some code Don’t trust user input Picking a choice at random Comparing values with if/elif/else Extra Credit What if we want to keep playing and not have it start over again all the time? Debugging (finding/fixing) Errors Super extra credit Still other approaches Whoa! That was a lot! Before you code, figure out what you’re trying to do with the code Let’s