Week 1: Hello World

Summary

This was our first lesson! We introduced ourselves and covered classroom basics (ask questions if you don’t understand, learning is more important than being right, etc.). We discussed what computers are, what input and output are (input = you feed information to the computer, output = the computer returns some information to you), and what computer programming actually is (giving instructions to a computer). Python is just one language you can use to give a computer instructions.

Values are data - things like 25, “Hello”, and 3.14159. Variables are just containers that hold that data. Each variable you use in code gets its own name - it’s like an envelope that you label so you remember what’s inside of it. You make variables in Python using the “assignment” operator, which is the equals sign (=). Here are some examples:

x = 5

my_text = “Hello, World!”

num3 = 3333.333

text_number = “500”

(Remember - you can tell if a variable is a String if it’s surrounded by ‘’ or “”)

There are 4 main types of data in Python:

  • Integers (numbers with no decimal place)
  • Floats (numbers with a decimal place)
  • Strings (text, surrounded by quotes)
  • Booleans (True or False)

We learned three commands:

  • print(), which prints out whatever you put in the parentheses
  • type(), which evaluates the type (integer, float, string, boolean) of whatever is in the parentheses
  • len(), which evaluates the length of whatever is in the parentheses. For example, len(“Hello!”) = 6

We also previewed some of Week 2’s material, mostly just the following simple mathematical operators:

“+” addition, 3 + 5 = 8

“-” subtraction, 10.1 - 6 = 4.1

“*” multiplication, 2 * 2 = 4

“/” division, 11 / 2 = 5.5

There are also two special math operators. The first is “//”, or floor division. This acts like remainder division, but leaves off the remainder. So, 13 // 5 = 2, and 4 // 100 = 0. And “%” is modulo, which acts like remainder division but only says the remainder. So, 5 % 3 = 2, 100 % 50 = 0, 7 % 10 = 7, etc.

We went over these toward the end of class, so we’ll review them at the beginning of Week 2.

Homework

The homework for this week is to get Python, and PyCharm, installed and working on your home computer. Instructions on how to do so are located in the “Installing Python” section on the left.

Once you’ve installed Python (the Anaconda version, as shown in the “Installing Python” section), you’ll automatically get a program on your computer called QTConsole. You can search for this either by using the Windows key (on a Windows machine) or by searching for it in the Finder (on a Mac). This is the console we used in class - try out some code on your own and see what you can do!

We won’t be using PyCharm for a little while, so just see if you can install and open the program - don’t worry about making anything with it.

And remember: if you have any difficulty, email me at tmeo@njgifted.org with questions!

Extra Resources

None

Lecture Slides