Week of January 8th, 2018
This blog will be used for both the Tuesday and Thursday night class. I will try to clearly show separations between each night where needed.
During this winter session of Code Em we will learn by doing! We will learn new concepts and solidify concepts we have come across before by taking a project-based approach during the twelve weeks. To name a few, project topics can include (not limited to): device building and programming with the Raspberry Pi, robot creations, 3D printing, Pi Soundboard, Python game design with Pygame, web applications, ethical hacking with Pi Zero or Kali Linux, Minecraft Modding with Java, Alexa skills, PiLexa and visual-based programming projects like Scratch and Hopsctoch.
The goal is to have one or several awesome projects by the end of our twelve weeks together. After completing projects, we will make sure we are comfortable enough with the stuff we learn to continue beyond the class.
While working on projects, students will have the opportunity to gain or expand their knowledge through a variety of programming languages and projects based on experience level, building from visual-based languages to text-based, like Python etc. They will learn source code control, software design, reverse engineering, bug resolution, and coding environments. 1
Whether we work in groups or individually during the weeks, we will always work with someone, i.e. instructors/mentors. To ensure this, we will use two key resources for help and teamwork: Slack & GitHub; both great tools for team collaboration. Slack is a messaging app and GitHub will serve as a place to save and keep track of all project work. We will use Slack to ask questions and collaborate on projects. We will use GitHub to save all our work to, keep track of projects, as well as help one another to solve any issues. You will need an accessible email account. Which bring us to our first assignment!
Create a new account for Slack and GitHub --you will need to verify the email address you sign up with for both. Don't forget your usernames and passwords! Once you have your own Slack and GitHub account, email your usernames to firstname.lastname@example.org or email@example.com, so we can add you to the class' Slack team. For those that already have both accounts, just make sure you can log into them! For more direction on joing the team on Slack, check out the intro to slack blog here.
Next week, we will narrow down project ideas and get our hands dirty.
On Thursday night, we took the random number game we have all played before and put it into a Python program using the chromebooks. Think of code or coding as a way to represent something, just in a different way. Here, we simply took a real-world game and used Python to represent it. Code is a way for conveying information between people; in this class, between people and machines. Code helps us communicate. You use code everyday without thinking about it, i.e. when you talk with someone, or when you write or read something --speech and text are considered code. So, you have been coding almost all of your life! Throughout class, we'll learn different ways to code.
We briefly talked about the fastest way to guess the correct number in a random number guessing game. We can divide the range of numbers in half on each guess. If the range is between 1 and 100, we can guess 50 first. If 50 is higher than the number picked, we now know the number is between 1 and 50, so we cut the range of possibilities in half! Then we can divide the range further by asking if the number is 25, and so on. This technique is how computers search through an ordered list, binary search.
import random number = random.randint(1, 100) print("I'm thinking of a number between 1 and 100.") GameRunning = True while GameRunning: guess = int(raw_input("Guess a number between 1-100: ")) if guess == number: GameRunning = False print("You guessed correctly!") elif guess > number: GameRunning = True print("Your guess was too high!") elif guess < number: GameRunning = True print("Your guess was too low!")
When you begin to write a program, it can seem overwhelming at first. We will get used to breaking up problems into small parts, and tackle them individually. We'll do a deep dive into all the syntax, methods, data types etc. involved with programming languages throughout the session. For now, I'll try to lay out each part of the program in a plain way:
Looking at the program above...
number = random.randint(1, 100) tells the program to choose a random integer between the range of 1 and 100 and put it into a variable,
The next line uses Python's
print() function. This function tells the program to display to the screen whatever is inside the parentheses. So, when the program is executed, the user understands the computer is thinking of a number between 1 and 100.
GameRunning = True is a variable equal to True. We will use this to either end the game or keep playing the game.
while GameRunning: is a loop (something that repeats). Any indented line underneat this will repeat as long as GameRunning is True.
guess = int(raw_input("Guess a number between 1-100: ")) Displays to the user what is in between the quotes, pauses the program, and waits for the user to enter an integer.
The next three blocks of code are conditional statements. These check whether the user chooses the correct number, a number higher, or a number lower than the random number originally picked. The program will keep waiting for the user to enter a number, until they enter the exact number chosen by the program in the beginning. Then the program will end, because of our condition: if the
guess is exactly equal to
GameRunning = False.
<variable> = <expr>
Binary Search - How a computers searches through an ordered list.
Relational Operators - Python compares what's on the left to what's on the right; usually used in a condition statement.
Don't worry if this all seems foreign to you (or you feel rusty)! Together, we'll learn by doing and practice, until it becomes second-nature.
Week of January 15th, 2018
This week, we started work on a few different goals. As is the case for almost every Tech Em class, there are varying levels of experience. We broke off into groups based on experience level and interest:
New students (new to Code Em) started work on a starter project to create a calculator program in Python with the end goal of using Turtle graphics to draw out the result. Students started work on their foundation in computer science and coding with an introduction to coding using the Python programming language.
We will be working with Python quite a bit throughout class. It is free and available at https://www.python.org/. You can continue to work on this project and/or practice more with Python at home by downloading Python from the link.
Returning Code Em students grouped up to either work on building a minecraft server on a Raspberry Pi, or started plans for a hands-on hardware project involving the Raspberry Pi Zero.
Other students started work on a visual-based coding app, Scratch.
Every project needs a plan. To ge the most out of each project, each day we will work on following an objective list. Another end-goal for each project is to create an easy-to-follow tutorial on whatever project you are working on. After each project is finished, we will publish these tutorials to the Tech Em blog page so others can replicate the steps you took!
Documenting your projects as you work on them will do a few useful things; help you understand what your are doing, keep track of where you are in the process, and help validate your project. The key is to log your work, so that other interested folks can learn what you did by following steps you took to get the same result. Similar to science experiments! --which you may have learned about already.
Make sure you have a GitHub and Slack account you can log into, and that you have been added to our class Slack Team. If you need help getting on the team, send an email to firstname.lastname@example.org.
Once on the Slack team, post your first message to break the ice! Post a relevant tech fact or personal experience in the
# code_em channel (e.g. I have been learning HTML on my own, or I prefer to use an iPad over a laptop, or my basketball team won a game recently, etc.)
Next week, we'll get started on creating our own GitHub repositories for each group to contribute to.
Enjoy the snow!!!