St. Perpetua 2023–24 Computer Science Elective, Trimester 2
Go to the latest lesson. See all classes.
Classroom and Self-Directed Learning Resources
- Google Classroom
- Mr. Briccetti’s YouTube Channel with many programming lessons for you to explore on your own
- MakeCode
- Block-based Programming Environments
- MicroBlocks
- Blockly Games
- Snap!
- Run Snap!
- Snap! Reference Manual
- Snap! Crash Course
- “Why Do We Have to Learn This Baby Language?” from Brian Harvey, Teaching Professor Emeritus, University of California, Berkeley
- micro:bit Python editor
- Visualizing your Python program with Python Tutor Visualizer
- p5.js
- Tinkercad
- Beauty and Joy of Computing Curricula
- BJC Sparks for Middle School and Early High School
- BJC for High School (you are free to explore this if you run out of things to do in the middle school curriculum)
- code.org
- Zooniverse
- Teachable Machine
- Music
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
2023-11-30
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.
Print, arithmetic, string literals, input
# 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!'
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!')
2023-12-05
Computing in the News
Low Budget Should Not Mean High Risk: Kids’ Tablet Came Preloaded with Sketchyware
Badges
- 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? ')
2023-12-07
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')
2023-12-12
Computing in the News
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!')
micro:bits
Earn a badge by showing you can create a program and download it to a micro:bit.
2023-12-14
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.'
2023-12-19
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
2024-01-09
Computing in the News
Symbols used in computer science (Symbols badge)
Learn the symbols with this program.
Graphics programming with p5.js (p5 badge)
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);
angleMode(DEGREES)
}
let angle = 0
function draw() {
background('black');
degreesToTurnThisFrame = mouseX / 50
rotateX(-30) // Tilt so we see from slightly above
rotateY(angle)
fill('orange')
stroke('red')
sphere(150)
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
2024-01-11
Symbols used in computer science (Symbols badge)
Learn the symbols with this program.
More p5.js.
2024-01-16
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.
2024-01-18
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
print('Right!')
# Increase the player's money by twice the amount of their bet
money += bet * 2
else:
# If the player guesses incorrectly, print a failure message
print('Wrong!')
# 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}')
2024-01-23
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
Beacon Finder
2024-01-25
Symbols used in computer science (Symbols badge)
Python (Python badge)
2024-01-30
Symbols badges are being printed
Python (Python badge)
2024-02-01
Symbols badges
A Python program to pair people for gift giving and the like
Self-Directed Learning
2024-02-06
Badges?
Introduction to Snap!
2024-02-08
Snap! Lesson with a chaser and chasee
Python Badge
Self-Directed Learning
2024-02-13
Computing in the News
p5.js
More Snap!
2024-02-15
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
print(score)
# 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')
else:
print('Too bad, please grow older for a while')
score = int(input('Your score? '))
if score >= 95:
print('A')
elif score >= 88:
print('B')
else:
print('F')
# loops
names = ['Bill', 'Sue', 'Jack']
for name in names:
print(name, 'likes to play foursquare')
for number in range(1, 11):
print(number)
2024-02-20
Computing in the News
Go language hits top 10 in the Tiobe index
Python Practice, and Badges
Self-Directed Learning
2024-02-22
p5.js
function setup() {
createCanvas(500, 600);
background('black');
}
function draw() {
stroke('blue')
line(0, 0, mouseX, mouseY)
stroke('red')
line(width, 0, mouseX, mouseY)
stroke('yellow')
line(width, height, mouseX, mouseY)
stroke('green')
line(0, height, mouseX, mouseY)
}
Self-Directed Learning
2024-02-27
Computing in the News
GoWyze camera security issue showed 13,000 users other owners’ homes
p5.js
2024-02-29
p5.js
Self-Directed Learning
2024-03-05
Computing in the News
Women in Computer Science: Adele Goldberg
Dave Briccetti (left) with Adele Goldberg (center) and the Agile Mind Team in 2006