Go to the latest lesson. See all classes.

Classroom and Self-Directed Learning Resources

First Day, 2023-11-28

Welcome to Computer Science

Join Your Class in Google Classroom

Computing in the News

What does a sustainable smartphone look like?

MakeCode for micro:bit

Self-Directed Learning


Python in repl.it

We’ll use repl.it to write and run Python code.

Here are the programs we created, with comments added by ChatGPT.

# Prints the string 'Hello World!' to the console.
print('Hello World!')

# Prints the string '4 * 5' to the console, not performing any calculation.
print('4 * 5')

# Calculates and prints the result of 4 multiplied by 5, which is 20.
print(4 * 5)

# Prompts the user to enter their name and stores the input in the variable 'name'.
name = input('What is your name? ')

# Uses an f-string to create a formatted string that includes the user's input.
# The f-string is a way to embed expressions inside string literals, using curly braces {}.
# The expression inside the curly braces gets evaluated and its result is inserted into the string.
print(f'Hello, {name}')

Conditions, “in”

# Ask the user how they are feeling and store the response in the variable 'feeling'
feeling = input('How are you? ')

# Check if the value of 'feeling' matches any of the positive feelings in the list
if feeling in ['fine', 'good', 'happy']:
    # If the feeling is positive, print 'Great!'

# Check if the value of 'feeling' matches any of the not-so-positive feelings in the list
if feeling in ['sad', 'tired', 'sick', 'not great']:
    # If the feeling is not so positive, print 'Oh, sorry!'
    print('Oh, sorry!')


Computing in the News

Low Budget Should Not Mean High Risk: Kids’ Tablet Came Preloaded with Sketchyware



  • p5.js
  • micro:bit
  • 3d modeling
  • Vocabulary, symbols and concepts
  • Python

Advent of Code

We will solve part 1 of the Day 1 puzzle together. Start with this repl.

Python Practice

# Hello, world
print('Hello, world!')

# Print result of multiplying 2 and 3
print(2 * 3)

# Ask for fav. team and save in variable
team = input('Favorite sports team? ')


Python Practice

fun = input('What do you do for fun? ')
if fun == 'video games':
    print('I also play video games!')
if fun == 'ride bikes':
    print('I like mountain bike riding')
# ask for the person’s favorite subject
# if they say 'cs', then respond with any message
subject = input('Fav. subj? ')
if subject == 'cs':
    print('Computer science is my favorite subject')


Computing in the News

Parrots learn to make video calls to chat with other parrots, then develop friendships, Northeastern University researchers say

Symbols used in computer science (Symbols badge)

  • Brackets
    • {}: Curly Brackets (braces)
    • []: Square Brackets
    • <>: Angle Brackets
    • (): Parentheses (if just one, it’s a “Parenthesis”)
  • #: Hash (also Pound Sign, Number Sign, or Octothorp, but never Hashtag)
  • /: Slash
  • \: Backslash
  • !: Exclamation Point (bang)
  • @: At Sign
  • *: Asterisk (splat)
  • _: Underscore
  • -: Hyphen
  • –: En-Dash
  • —: Em-Dash
  • <: Less Than
  • >: Greater Than
  • ;: Semicolon
  • :: Colon
  • ': Single Quote or Apostrophe
  • ": Double Quote

Python practice

The assignment and equality operators

# Difference between = and ==

# = is the assignment operator
# == is the equality operator, which is one of the comparison operators

# assign the value 100 to the variable “grade”
grade = 100  # assignment operator

# now, we want to know if the student gets an “A”
# you have to have 100% to get an A

if grade == 100:  # equality operator
    print('Hurray, you got an A!')


Earn a badge by showing you can create a program and download it to a micro:bit.


Symbols used in computer science (Symbols badge)

Learn the symbols with this program.

Python practice

# Assign the value 520 to a variable called “speed”
speed = 520
# Assign the value 0 to a variable called score
score = 0
# Assign the string 'Mr. B.' to a variable called teacher
teacher = 'Mr. B.'


Symbols used in computer science (Symbols badge)

Learn the symbols with this program.

Python practice

Introduction to Tinkercad (3D Badge)

Follow the link in Google Classroom.

Self-Directed Learning


Computing in the News

Moving Pixel Clock Project

Symbols used in computer science (Symbols badge)

Learn the symbols with this program.

Graphics programming with p5.js (p5 badge)

Mr. B’s Conway’s Game of Life

Let’s write something together using the p5.js editor.

Centered Circle

// The setup function runs once at the start.
function setup() {
  createCanvas(400, 300);

// The draw function is called once for each frame of animation
// (perhaps 30 or 60 times each second).
function draw() {
  background('green'); // Clears the canvas and fills with a color
  // The “origin” (0, 0) is at the top left. This draws a centered circle.
  // “width” and “height” contain the values set in the createCanvas call above.
  circle(width / 2, height / 2, 100)

Sphere Rotating at Varying Speeds

function setup() {
  // “WEBGL” here means we’ll draw in 3D rather than 2D
  createCanvas(400, 400, WEBGL);

let angle = 0

function draw() {
  degreesToTurnThisFrame = mouseX / 50
  rotateX(-30) // Tilt so we see from slightly above
  angle += degreesToTurnThisFrame // Rotate by the requested amount

Mr. B. has other p5.js programs you can look at later, on his software page.

Self-Directed Learning


Symbols used in computer science (Symbols badge)

Learn the symbols with this program.

More p5.js.


Computing in the News

Robots key to new ways of farming as labor shortage looms

Symbols used in computer science (Symbols badge)

More p5.js and Python.


Symbols used in computer science (Symbols badge)

Python (Python badge)

# Import the randint function from the random module
from random import randint

# Set the initial amount of money the player has
money = 100

# Start an infinite loop to run the betting game
while True:
  # Ask the player to place a bet and store it as an integer
  bet = int(input('Bet how much? '))
  # Generate a random number between 1 and 3 (inclusive)
  number = randint(1, 3)

  # Ask the player to guess a number and store it as an integer
  guess = int(input('Your guess? '))

  # Check if the player's guess matches the randomly generated number
  if guess == number:
    # If the player guesses correctly, print a success message
    # Increase the player's money by twice the amount of their bet
    money += bet * 2
    # If the player guesses incorrectly, print a failure message
    # Decrease the player's money by the amount of their bet
    money -= bet

  # Print the current amount of money the player has
  print(f'You now have ${money}')


Symbols used in computer science (Symbols badge)

Python (Python badge)

We’ll review last Thursday’s code.

Preparing for a micro:bit treasure hunt


Beacon Code

Beacon Finder

Beacon Finder Code


Symbols used in computer science (Symbols badge)

Python (Python badge)


Symbols badges are being printed

Python (Python badge)


Symbols badges

A Python program to pair people for gift giving and the like

Self-Directed Learning



Introduction to Snap!


Snap! Lesson with a chaser and chasee

Python Badge

Self-Directed Learning


Computing in the News

OpenAI Gives ChatGPT a Memory


More Snap!


Python Practice, and Badges

# print

# print the result of adding 3 and 4
print(3 + 4)

# print the expression 3 + 4
print('3 + 4')

# variables
# Create a variable called score, and give it a value of 100
score = 100
# Now print the value of that variable

# input
# ask for the person’s favorite book/team/etc and save in a variables called fav
fav = input('Fav team? ')
# input with numbers
age = int(input('How old are you? '))
# if
if age >= 13:
    print('Congrats, you may use ChatGPT at school')
    print('Too bad, please grow older for a while')

score = int(input('Your score? '))
if score >= 95:
elif score >= 88:

# loops
names = ['Bill', 'Sue', 'Jack']
for name in names:
    print(name, 'likes to play foursquare')

for number in range(1, 11):


Computing in the News

Go language hits top 10 in the Tiobe index

Python Practice, and Badges

Self-Directed Learning



function setup() {
  createCanvas(500, 600);

function draw() {
  line(0, 0, mouseX, mouseY)
  line(width, 0, mouseX, mouseY)
  line(width, height, mouseX, mouseY)
  line(0, height, mouseX, mouseY)

Self-Directed Learning


Computing in the News

GoWyze camera security issue showed 13,000 users other owners’ homes




Self-Directed Learning