Course Outcomes
Aspirations in Computing Award (for women, genderqueer, or non-binary students with strong interests in computer technology)
Desktop - IDLE (General programming + graphics)
VS Code for Education (General programming, no graphics yet)
This course is planned to begin during the 2024-2025 school year and will be a python programming course.
This course is designed to offer an additional programming course prior to CS1, CS2, and CS3 that introduces (in a more structured format than CS Intro) the fundamental programming topics universal to programming languages, namely:
Variables
Sequences
Math
Conditionals
Randomization
Loops
Functions
Inputs/Outputs
The next level course, CS1 will cover these same concepts, but they will differ in the following ways:
Language: Python
Focus: Solidifying the programming topics
More Learning & Solidifying concepts
Language: Java
Focus: Utilizing/Applying the programming topics to solve problems
More Using & Applying Concepts
QualtricsXM Beginner's Glossary of Coding & Programming Terms (Suggested by the KCCSD Stem Club)
You will be expected throughout the semester to take notes on the content in the class in a Physical notebook.
Cornell Notes - The Cornell Note Taking System
Slides - Lesson 1 - Fundamentals
print("Hello World")
print("Number: ", num)
print("Number: " + str(num))
print(f"Number: {num}") --> This type of print uses f-strings to quickly add variables to outputs (it's my favorite)
Go to your home page in VS Code for Education
Navigate to "My Projects"
Create a new Project
Name: "My Python Challenges - YourName"
Description: "This is where I'll store my Python Challenge code."
VSCode will auto create a main.py file. Ignore this.
Create a new File called "Challenge01_Poem.py"
Using multiple print statements, write out the lyrics of a poem
this could be the lyrics to your favorite song
this could be something you make up off the top of your head
Not all characters are printable due to how the computer interprets text.
print("I love the " symbol, it's my favorite.")
In the above example, the " (quotation mark, not apostrophes) messes everything up.
Read up on Python Escape Characters to get a better understanding of special printing situations
Slides - Lesson 2 - User Interactions
name = input("What is your name")
print("Nice to meet you, ", name)
Write a MadLibs program
Must take 5+ values from the user
Must plug those values into a story.
See Chef's MadLib as an example
Explore using conditionals to be able to respond to the user when certain inputs are provided
Example: When the user inputs a name, always with respond with "Oh, [name they typed] is such a cute name!" unless the name is "Jack", then respond with "Who! like Jack Jack from the Incredibles!"
Slides - Lesson 3 - Values
Python Casting (Converting Data Types)
Assign Multiple Values (Optional, advanced)
Casting (Converting) Data Types
Operators - Focus on Arithmetic, Assignment, & Precedence.
Arithmetic: +, -, *, /, %, **, //
Assignment: =, +=, -=, *=, /=, %=, //=, **= ... ignore Bitwise operators.
Precedence:
()
**
*, /, //, %
+, -
price = 59.9899999999
txt = f"The price is {price:.2f} dollars"
print(txt)
In the example above:
price holds the ugly number that you want formatted.
Txt holds the formatted version of the text, and the portion that says "{price:.2f}" gets replaced with price's value formatted by 2 digits after the decimal.
This also takes care of rounding, so the example above (58.9899999) rounds up to 58.99.
Global Variables (Specific to Python)
Complete the HiLo Game Challenge
Level 1
Write a program that sums the positive multiples of
3 or 5 that are less than 30. No number should be
added more than once.
Level 2
Write a function that does the same thing listed above, except:
- the 3, 5, and 30 should all be represented by parameters.
Example call statements:
- findSumOfMultiples(3, 5, 30) --> Should get same result.
- findSumOfMultiples(2, 7, 100) --> Should find the sum of
all multiples of 2 & 7 below 100.
Level 3
Ask the user if they'd like to do a sumOfMultiples calculation (yes/no).
As long as they don't say no (or as long as they say yes), Get the 3
values as parameters (num1, num2, & limit), pass them into the
function, and print the result. Repeat. The user should be able to
properly escape at any point.
Level 4
Don't allow invalid inputs
If they don't type yes or no, the program should tell them that option was invalid and force them to retry. Make this its own function.
If they provide any negative numbers, the program should tell them those are not valid for this program. Make this its own function.
Complete the following 3 Sasquatch-themed problems (Posted in Cavas):
Signal Search
The Footprint Chase
Hidden Cave
Fun side note: The following image was generated by AI using the following prompt: "Draw a Pixar style Sasquatch who looks friendly and rugged." - ChatGPT (though, probably used Dall-E to generate it)
Complete this quiz - If the paper is handed to you, fill it out on the paper. Otherwise, write your answers on a separate piece of paper, to be turned in by the end of the period.
You're to write a program that simulates an elementary school quiz program. This program should:
The computer Randomly Generate 2 random numbers from 0 to 99
The computer Display the numbers as an addition problem the student (user) needs to solve.
The student solves the math problem (input)
The computer determines whether the user was correct or not.
As long as the user hasn't gotten 3 problems wrong, the program repeats.
Track the total number of questions asked.
Track the total number of questions correct or incorrect (I'll let you decide, but you don't have to track both - if you track 1, you can calculate the other).
Example Dialog: (user input in orange)
Welcome to my math program! Let's see how you do.
Question #1: 13 + 17: 30
Correct!
Question #2: 19 + 4: 22
Ooh, sorry, but the correct answer was 23.
... (the program continues)
Question # 13: 66 + 11: 88
Ooh, sorry, but the correct answer was 77.
Out of 13 questions asked, you got 10 of them correct!
Iterate over a sequence (list, set, String, etc.)
Don't use break statements.
Make use of the range option:
range(#) --> for i in range(6) will 6 times (0-5)
range(#, #) --> for i in range(3, 7) will loop from 3 to less than 7 (3-6)
range(#, #, #) --> for i in range(10, 100, 5) will loop from 10 to less than 100, increasing by 5 (10, 15, 20, 25... 90, 95)
Story: Deep in the heart of the forest, Sasquatch stumbled upon a curious device—a fitness tracker flung off a hiker's wrist in a moment of panic. Intrigued by this new gadget, Sasquatch decided to use it to track his daily wanderings. However, the tracker had a quirk: it reset at midnight each night due to the rough handling it endured. Determined to know his weekly step count, Sasquatch diligently recorded his steps at the end of each day for a week. Your mission is to help Sasquatch calculate the total number of steps he took over these 7 days.
Objective: Write a program that:
Prompts the user to enter the number of steps Sasquatch took each day for 7 days.
Calculates the total number of steps taken over the week.
Prints the total number of steps.
Example Output:
Enter the steps for day 1: 10000
Enter the steps for day 2: 12000
Enter the steps for day 3: 8000
Enter the steps for day 4: 15000
Enter the steps for day 5: 11000
Enter the steps for day 6: 9000
Enter the steps for day 7: 13000
Total steps taken in the week: 78000
Hints:
Use a for loop to iterate through the 7 days.
Use a variable to keep a running total of the steps.
Make sure to convert the input from the user to an integer before adding it to the total.
Story: One misty morning, Sasquatch decided to explore a hidden valley deep in the forest. Along the way, he found five mysterious stones, each with a unique number carved into it. Curious about the significance of these numbers, Sasquatch wants to analyze them. He needs to find out the smallest and largest numbers, as well as the sum and average of all five numbers. Your task is to help Sasquatch with this numerical quest.
Objective: Write a program that:
Prompts the user to enter five numbers.
Finds and prints the smallest number.
Finds and prints the largest number.
Calculates and prints the sum of the numbers.
Calculates and prints the average of the numbers.
Example Output:
Enter number 1: 7
Enter number 2: 13
Enter number 3: 5
Enter number 4: 20
Enter number 5: 9
Smallest number: 5
Largest number: 20
Sum of numbers: 54
Average of numbers: 10.8
This challenge can be solved without storing the contents in lists and without needing variables for every number received.
You should:
Loop 5 times
Get a number
Add it to the sum
Figure out if it's the largest # found so far
Figure out if it's the smallest # found so far
Calculate the average
Print all the important info.
Python has a neat shortcut for calculating powers:
3**5 --> 3 to the power of 5
Even though Python offers this method of calculating powers, not all programming languages do.
You're tasked with creating a program that simulates this method of calculating powers by using a for loop.
Get 2 #'s from the user (base, power)
set an initial product value as 1 (similar to how we set sums to 0)
Loop power times:
Multiply the product by the base.
Example:
Base Input: 7
Power Input: 4
(1st loop: Product --> 1 * 7 = 7)
(2nd loop: Product --> 7 * 7 = 49)
(3rd loop: Product --> 49 * 7 = 343)
(4th loop: Product --> 343 * 7 = 2401)
7 to the power of 4 is 2401
Sasquatch can't read. He does, however, recognize certain letters as being special, namely the symbols we refer to as a, e, i, o, and u (capital and lowercase versions) - You and I know these as vowels, but sasquatch just gets a feeling they're special.
Sasquatch is so drawn to these that every time he finds some text left by hikers - a book, an article, a brand name on a backpack - he counts the vowels.
Create a program that simulates Sasquatch counting vowels.
Get some text from the user
Loop through all the letters
If the letter is a vowel
Increase a counter
Print the number of vowels found in the text.
W3Schools
Slicing Strings (Substring)
Modify Strings - Important Note: These functions create a copy that is modified. The variable itself remains unchanged.
Rounding Strings
price = 59.9899999999
txt = f"The price is {price:.2f} dollars"
print(txt)
In the example above:
price holds the ugly number that you want formatted.
Txt holds the formatted version of the text, and the portion that says "{price:.2f}" gets replaced with price's value formatted by 2 digits after the decimal.
This also takes care of rounding, so the example above (58.9899999) rounds up to 58.99.
A sentence is said to be balanced if the number of spaces + vowels is the same as the number of other symbols (including punctuation).
You need to figure out whether or not the characters are balanced.
Hello --> Not Balanced (3 consonants, 2 vowels/spaces).
Here We'll Be --> Not Balanced
AEIOU BCDFGH> Balanced (5 vowels + 1 space, 6 consonants)
Under Construction
Take the Final Multiple Choice Test - 31 questions - 45 minutes to take
You're writing a program meant to take in 2 numbers and count how many operations it takes for the 1st number to get to the 2nd number using only the following operations:
You can add 1 to the number.
You can divide the number by 2 (but only when the number is currently even).
You have approximately 45 minutes to complete this challenge.
Starting #: 21
Ending #: 5
Process:
21+1 --> 22
22/2 -->11
11+1 --> 12
12/2 --> 6
6/2 --> 3
3+1 --> 4
4+1 --> 5
Return 7
Try your hand at your own examples
set a counter to 0
as long as the currentNum isn't the targetNum
if the currentNum is less than the targetNum
increase the counter by 1
increase the currentNum by 1
otherwise
if the currentNum isn't even (ie. is odd)
increase the currentNum by 1
otherwise
divide the currentNum by 2
increase the counter by 1
return the counter
'''
countSteps takes in a currentNum and a targetNum
and follows the logic provided in the "Programming
Challenge Logic" statement.
@param currentNum the starting number passed in which
eventually transforms into the ending number.
@param targetNum the number that currentNum is trying
to transform into.
@return the number of steps it takes for currentNum to
transform into the targetNum.
'''
#define countSteps here as described above
##################################################
'''
Main Section
Do not change anything below here
'''
numLoops = int(input("How many loops?"))
for i in range(numLoops):
startNum = int(input("What is the starting number?"))
targetNum = int(input("What is the ending number?"))
answer = countSteps(startNum, targetNum)
print(f"The total number of steps to go from {startNum} to {targetNum} is {answer}")
CISCO Network Academy - Python Essentials 1 Course - Python Essentials 2 Course
Curriculum - Carnegie Mellon Introduction to Programming (Great supplemental Opportunity!)
Curriculum - Runestone How to Think Like a Computer Scientist: Interactive Edition
Curriculum - MIT OpenCourseWare - Intro to CS & Programming Using Python
Curriculum - Harvard's CS50
Curriculum - MIT OpenCourseWare - A Gentle Introduction to Programming Using Pythong
Wiingy - Wiingy Learn Python
Curriculum - Google For Education - Python
Youtube - Harvard's CS50 course
Youtube - "I learned Python By Building These Projects - Tutorial for Beginners"
Tutorial - Replit's "100 days of python"
Tutorial - Replit's "Creating Art Using Turtle Python"
Tutorial - Replit's "Code Art - Master the Basics" (uses Turtle Python)
Tutorial - Replit's "Learn Stenography in Python"
Challenges - 101 Computing Python Beginner
Supplemental - EarSketch
Video Tutorial - 14 Hours of Python Game Development - From Beginner to Advanced
Video - Python Dunder Methods
Youtube Short - isPrime filter
Python Institute PCEP Exam (Python Certified Entry-Level Programmer