St. Perpetua 2023–24 Computer Science Elective, Trimester 3
Go to the latest lesson. See all classes.
Classroom and Self-Directed Learning Resources
- Mr. Briccetti’s YouTube Channel with many programming lessons for you to explore on your own
- MakeCode
- Block-based Programming Environments
- MicroBlocks
- EduBlocks
- 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, 2024-03-12
Welcome to Computer Science
Join Your Class in Google Classroom
Computing in the News
MakeCode for micro:bit
Self-Directed Learning
2024-03-14
micro:bit game
Self-Directed Learning
2024-03-19
Computing in the News: Grace Hopper
Questions
- When did she live?
- Where did she get her math and physics degrees?
- Where did the term “debugging” come from?
- What programming language did she help develop?
- What computers did she work on at Harvard?
- What did she say is her greatest accomplishment?
Programming the micro:bit in Python
Explore examples in the Ideas tab.
Self-Directed Learning
2024-03-21
Programming the micro:bit in Python
Tilting Dot Program
from microbit import *
x = 2
y = 2
while True:
ax = accelerometer.get_x()
if ax > 200 and x < 4:
x += 1
if ax < -200 and x > 0:
x -= 1
ay = accelerometer.get_y()
if ay > 200 and y < 4:
y += 1
if ay < -200 and y > 0:
y -= 1
display.clear()
display.set_pixel(x, y, 9)
sleep(250)
Explanation of the Code
(from Google Gemini Advanced)
Setting Up
from microbit import *
This line tells the computer to use a module called “microbit” to control the micro:bit.
Our Characters
x = 2
y = 2
Just like in a story, we have charactersx
andy
. They keep track of where something is shown on the screen, like where a game character might start.
The Main Loop (Happens Repeatedly)
while True:
This line says, “Keep doing the things inside this block of code over and over again!”
Sensing Movement
ax = accelerometer.get_x()
ay = accelerometer.get_y()
The micro:bit has a special sensor to detect how it’s tilted. These lines find out how much it’s tilted sideways (ax
) and up-and-down (ay
).
Moving Right
if ax > 200 and x < 4:
If… the micro:bit is tilted a lot to the right (more than a number 200) and our characterx
isn’t all the way to the right edge (less than a number 4), then…x += 1
This line moves our characterx
one step to the right.
Moving Left, Up, and Down (Similar to Moving Right)
These parts of the code work similarly to how we checked for moving right.
Drawing and Clearing
display.clear()
This line erases anything that was previously shown on the micro:bit’s tiny screen.display.set_pixel(x, y, 9)
This line draws a bright dot (because9
means bright) on the screen.
Short Pause
sleep(250)
This line tells the computer to wait.
2024-03-26
Computing in the News
U.S. hits Apple with landmark antitrust suit, accusing tech giant of stifling competition
2024-04-09
Computing in the News
Google to destroy billions of data records to settle “incognito” lawsuit
Tinkercad Circuits
Self-Directed Learning
2024-04-11
Snap!
2024-04-16
Computing in the News
35-gram Hopcopter revolutionizes robotics with its hops and flight
Snap!
Self-Directed Learning
2024-04-18
Snap! Clones
Self-Directed Learning
2024-04-23
Computing in the News
“The Impossible Statue” Uses AI To Blend The Styles Of Five Master Sculptors
Practice Quiz on Kahoot
Self-Directed Learning
2024-04-23
Python in repl.it
We’ll use repl.it to write and run Python code.
Here’s the code we wrote, with comments and an explanation added by Gemini Advanced:
# This line prints the classic message 'Hello, world!' to the screen
print('Hello, world!')
# This line asks the user to input their favorite team and stores it in a variable called 'team'
team = input('Favorite team? ')
# This 'if' statement checks if the team entered is exactly 'Warriors'
if team == 'Warriors':
# If it is, this line prints a positive message
print('Good choice!')
# This 'elif' statement checks if the team entered is exactly '49ers'
elif team == '49ers':
# If it is, this line prints a slightly less enthusiastic message
print('Oh, them?')
# This 'else' statement runs if none of the above conditions were met
else:
# This line indicates the user picked a team the program doesn't recognize
print("I don't know that team.")
print() function: This tells the computer to display text on the screen.
Comments: Lines starting with #
are ignored by the computer, but they help humans understand the code.
input() function: This lets the user type something in and stores it.
Variables: These are like containers for storing information (in this case, the user’s favorite team).
if/elif/else statements: These control the flow of the program.
- The code checks different conditions one after the other.
- Only the code block of the first matching condition will run.
Self-Directed Learning
2024-04-30
Computing in the News
How TikTok’s algorithm personalizes what you see
Python in repl.it
Review of the code we wrote last time.
Self-Directed Learning
Student Progress Report
2024-05-02
Python in repl.it
Quiz
Randomness Functions
- random
- randint
- choice
Self-Directed Learning
Student Progress Report
2024-05-07
Computing in the News: A project from Adafruit Show and Tell
EarSketch
Let’s make music with Python!
Self-Directed Learning
Student Progress Report
2024-05-09
Developing an iOS application with Xcode
Mr. B. is learning how to make iOS apps, and he wants to share his progress with you.
EarSketch
Let’s make music with Python!
Self-Directed Learning
Student Progress Report
2024-05-14
Computing in the News
Scientists find 57,000 cells and 150m neural connections in tiny sample of human brain
Python Practice
We’ll use repl.it to write and run Python code.
Self-Directed Learning
Student Progress Report
2024-05-16
Python Practice
We’ll use repl.it to write and run Python code.
Self-Directed Learning
Student Progress Report
2024-05-21
Computing in the News
Robotic palm mimics human touch
code.org Music Lab
New Badges
Self-Directed Learning
Student Progress Report
2024-05-23
code.org Music Lab
Review
Self-Directed Learning
Student Progress Report
2024-05-28
Computing in the News: GPT-4o - How to Use ChatGPT Mac Desktop App
Badges
3D Printing Your Creations
Tinkercad, Slicer
Self-Directed Learning
Make something interesting, and write about it in detail near the end of class in your progress report.