Difference between revisions of "Computer Science"
From WLCS
Line 1: | Line 1: | ||
− | == Friday (4/ | + | == Friday (4/8/11) == |
'''Warmup:''' | '''Warmup:''' | ||
# Assume you have the following numbers: 5, 3, 7, 2, 1, 8 | # Assume you have the following numbers: 5, 3, 7, 2, 1, 8 |
Revision as of 14:05, 8 April 2011
Contents
- 1 Friday (4/8/11)
- 2 Wednesday - Thursday (4/7/11 - 4/8/11)
- 3 Monday - Tuesday (4/4/11 - 4/5/11)
- 4 Monday - Wednesday (3/28/11 - 3/30/11)
- 5 Thursday (3/24/11)
- 6 Wednesday (3/23/11)
- 7 Monday - Tuesday (3/21/11 - 3/22/11)
- 8 Thursday - Friday (3/17/11 - 3/18/11)
- 9 Tuesday - Wednesday (3/15/11 - 3/16/11)
- 10 Friday - Monday (3/11/11 - 3/14/11)
- 11 Wednesday - Thursday (3/9/11 - 3/10/11)
- 12 Monday - Tuesday (3/7/11 - 3/8/11)
- 13 Thursday - Friday (3/3/11 - 3/4/11)
- 14 Tuesday - Wednesday (3/1/11 - 3/2/11)
- 15 Friday-Monday (2/25/11-2/28/11)
- 16 Wednesday - Thursday (2/24/11)
- 17 Friday - Tuesday (2/18/11-2/22/11)
- 18 Wednesday - Thursday (2/16/11-2/17/11)
- 19 Monday - Tuesday (2/14/11-2/15/11)
- 20 Friday (2/11/11)
- 21 Wednesday-Thursday (2/9/11-2/10/11)
- 22 Monday-Tuesday (2/7/11-2/8/11)
- 23 Friday (2/4/11)
- 24 Wednesday - Thursday (2/2/11-2/3/11)
- 25 Monday (1/31/11) - Tuesday (2/1/11)
- 26 Monday - Tuesday (1/24/11 - 1/25/11)
- 27 Thursday - Friday (1/13/11 - 1/21/11)
- 28 Tuesday - Wednesday (1/11/11 - 1/12/11)
- 29 Friday - Monday (1/7/11 - 1/10/11)
- 30 Wednesday - Thursday (1/5/11 - 1/6/11)
- 31 Monday - Tuesday (1/3/11 - 1/4/11)
- 32 Archives
Friday (4/8/11)
Warmup:
- Assume you have the following numbers: 5, 3, 7, 2, 1, 8
- Open notepad and write down the steps that your brain takes in finding the 2
Agenda:
- Linear search algorithm
- Work on the Advanced Python List Exercises
Wednesday - Thursday (4/7/11 - 4/8/11)
Warmup:
- Assume you have the list nums = [2, 4, 6, 8, 10]
- Print out the first element
- Print out the last element
- Print out the middle element
Warmup 2:
- Create an empty list named nums2
- Append the following numbers to nums: 8, 6, 7, 5, 3, 0, 9
Agenda:
- List Review
- Introduction to advanced list algorithms
- Work on the Advanced Python List Exercises
Monday - Tuesday (4/4/11 - 4/5/11)
Agenda:
- Watch Rise of the Video Game: Part 1
- Watch Rise of the Video Game: Part 2
Monday - Wednesday (3/28/11 - 3/30/11)
Agenda:
- Complete the Python List Exercises and demo to Mr. Bui (at the beginning of next class)
- Work on the Advanced Python List Exercises
Thursday (3/24/11)
Agenda:
- 1st half of class: study for the 3rd Quarter Exam
- 2nd half of class: take the 3rd Quarter Exam
- Complete the Python List Exercises
Wednesday (3/23/11)
Agenda:
- 3rd Quarter Exam Review on Friday (3/25/11)
- Introduction to Lists
Monday - Tuesday (3/21/11 - 3/22/11)
Warmup:
- Have you ever created a list of items before?
- Create an example list of items (e.g. grocery, homework, todo, etc.)
Agenda:
- Demo Pig Latin Translator (due today)
- Study for 3rd Quarter Exam
- Strings with functions, conditionals, and loops (e.g. E-mail Harvester, Leet Translator, Pig Latin)
- Introduction to Lists
- Media:Lists_Python.ppt
- Complete the Python List Exercises
Thursday - Friday (3/17/11 - 3/18/11)
Warmup:
- Translate the following words into pig latin:
- Washington
- Generals
- Chair
- Street
- I
Agenda:
- Begin working on Pig Latin Translator
Tuesday - Wednesday (3/15/11 - 3/16/11)
Agenda:
- Demo Leet-speak Translator
- Begin working on Pig Latin Translator
Friday - Monday (3/11/11 - 3/14/11)
Warmup:
- Without running it on your computer, what does the following source code print at the end?
newString = ""
x = 0
while x < 5:
newString = newString + "l"
newString = newString + "o"
x = x + 1
print newString
Agenda:
- Make sure you've submitted your *commented* E-mail Harvester Assignment
- Leet-speak Translator
Wednesday - Thursday (3/9/11 - 3/10/11)
Warmup:
- Bring up your E-mail Harvester and compare to Mr. Bui's version
Agenda:
- E-mail Harvester Assignment walkthrough
- After completing E-mail Harvester Assignment, go through and comment each line and explain its purpose
Monday - Tuesday (3/7/11 - 3/8/11)
Warmup:
- Assume you have the string s = "Arg...today is Tuesday!"
- Write the code to print out the t from string s
- Write the code to print out the ! from string s
- What are indexes of the the "..."?
- Write the code to print out the '...' from string s
Agenda:
- E-mail Harvester Assignment
- After completing e-mail harvester, go through and comment each line and explain its purpose
Thursday - Friday (3/3/11 - 3/4/11)
Warmup:
- Write a while loop that uses a counter variable i
- The while loop should count and print 0 through 50
- Put an if-statement in the loop, and if i is greater than 11, then print it out
Agenda:
Tuesday - Wednesday (3/1/11 - 3/2/11)
Warmup:
- Please fill out this survey
Agenda:
- Welcome back!
- Strings review
- Print out all the vowels of a string
- Turn it into a function
- What else can we do with it?
- Python String Exercises
- E-mail Harvester Assignment
- Strings quiz on Thursday? (on Python String Exercises)
Friday-Monday (2/25/11-2/28/11)
Warmup:
- Copy the following code into python, which is supposed to print every character of s
s="Puff Dragon"
i=1
while i<len(s)-1:
print s[i]
i+=1
- Fix the code
- Change the code so it prints in reverse order, from end to start.
Agenda:
- Finish 12-14 in Python String Exercises and resubmit
- Reference: Media:Strings_Python.ppt and HTTLCS, Chapter 7
- Work on the E-mail Harvester Assignment - review warm up below first.
- If you finish it, work on HTTLCS, Chapter 7
- First do ex. #s 5,6,7 then 1,2 and 8-10
Wednesday - Thursday (2/24/11)
Warmup:
- Copy the following code into python
def matches(target,test):
len_target=len(target)
if test[0:len_target]==target:
return True
else:
return False
target=raw_input("Enter target string:")
test=raw_input("Enter test string:")
print matches(target, test)
- Try it with each of the following input pairs:
target | test | result |
---|---|---|
out | outside | |
inner | in | |
ann | Ann | |
side | outside | |
mi | michael |
- What overall rule does the program follow - be specific?
- Try your own inputs, and see if the results match your expectation.
- Why might this be useful?
- Add comments to the code, describing what each line does - be specific.
Agenda:
- Finish 12-14 in Python String Exercises and resubmit
- Reference: Media:Strings_Python.ppt and HTTLCS, Chapter 7
- Work on the E-mail Harvester Assignment - review warm up below first.
- If you finish it, work on HTTLCS, Chapter 7
- First do ex. #s 5,6,7 then 1,2 and 8-10
Friday - Tuesday (2/18/11-2/22/11)
Warmup:
- Jot notes on the format of an email address:
- What character must be in an email?
- What characters can never be in an email?
- Within a sentence, how are words separated?
- How could you detect where an email starts and end?
Agenda:
- Complete PPT Strings_Python Updated
- Reference: HTTLCS, Chapter 7
- Then complete Python String Exercises - all exercises and resubmit
- Finally, work on the E-mail Harvester Assignment
- If you finish it, work on HTTLCS, Chapter 7 exercises 1,2 and 5-10
Wednesday - Thursday (2/16/11-2/17/11)
Warmup:
- Using python, create a variable sample and set it to "We're Building a Better Internet".
- Write expressions that:
- Print the first character
- Print the third character (the apostrophe)
- Print the first "B"
- Print the second from last character (hint: use the len() function)
- Print the word 'Building'
- Print the word 'Internet'
- Tip: Use print ":"+sample[x:y]+":" to see exactly what is in your slice (check for extra spaces at the start or end).
Agenda:
- Review PPT Media:Strings_Python.ppt
- Reference: HTTLCS, Chapter 7
- Interim grades are due - so demo/submit Robot, if you haven't already.
- Then complete Python String Exercises - all exercises and resubmit
- Finally, work on the E-mail Harvester Assignment
Monday - Tuesday (2/14/11-2/15/11)
Warmup: When is 1 + 1=11?
- Write a short program that asks the user for two values using raw_input (not input).
- Add the two values and store them in a third variable, then print this variable.
- Test your program by entering your first name and last name.
- Try it again with the values ‘1’ and ‘1’
- If you're ahead, overview HTTLCS, Chapter 7
Agenda:
- Interactive presentation Media:Strings_Python.ppt - Slides 1-9
- Complete/submit Python String Exercises - 1 to 11 only
- Reference: HTTLCS, Chapter 7
- Demo/submit Robot, if you haven't already.
- If you're ahead, work on Dodge.
- Work on the E-mail Harvester Assignment
Friday (2/11/11)
Warmup:
- Review the Robot project rubric - work out how you can get most points
- Player sprite must be able to move in four directions using the keyboard : 5 pts
- The player sprite wraps at the edges of the screen : 10 pts
- 5-10 collectable items (coins) are created and placed onscreen: 10 pts
- Items are removed once the player ‘collects’ them: 10 pts
- A robot sprite follows the player around the screen : 10 pts
- If the player collides with the robot, then the player loses (and the game ends) : 5 pts
- If the player collects all the items, then the player wins (and the game ends): 10 pts
- Code legibility (meaningful variable names and code comments): 10 pts
- Code parsimony (no redundant or convoluted code): 10 pts
- Completed on time: 10 pts
Agenda:
- Demo Robot game : due today
- Then put your name at the top, print it and submit to schoolweblockers with your name in the filename.
- If you've completed Robot, work on the Dodge game
- Depending upon how many people are complete, we may start on String- see File:Strings Python.ppt
Wednesday-Thursday (2/9/11-2/10/11)
Warmup:
- Variable scope
- Without using a computer write down answers to the following questions:
- Where is 'myVar' defined (created)?
- In what order will the print statements be run?
- What value will 'myVar' have each time?
Now copy the program into Python and test it. - What values were actually printed?
- Was this the same or different from what you expected? Why so? Discuss with your partner.
- Inserted the following line at line 5 (just after the 'def test' line)
print "In test, at start, myVar=", myVar
Why does this create an error?
myVar=0
print "At start, myVar=",myVar
def test(input_var):
myVar=input_var+1
print "In test, at end, myVar=",myVar
myVar=1
print "Before test, myVar=:",myVar
test(myVar)
print "At end, myVar=:",myVar
Agenda:
- Demo Robot game : due for P2 class on Friday (2/11/11) or Monday for P1 class (2/14/11)
- Then put your name at the top & print it
- Finally, rename it LASTNAME_FIRSTNAME_Robot.py and submit on school web lockers
- If you've completed Robot, work on the Dodge game
- We'll start on Strings (HTTLCS Ch 7) next week
Monday-Tuesday (2/7/11-2/8/11)
Warmup:
- Replacing constants with variables
- In this example, boxes are created in the four corners and center of the window.
- But what if we changed the size of the window (line 2)? Each box would have to be changed too - not very efficient.
- Instead, create variables for the window width (400) and height (300), and the box size (20).
- Then replace the box's coordinates (lines 4-8) with a 'variable expression'
- So line 4 would be Box((windowWidth-boxSize,0),boxSize,boxSize,filled=False,color=color.RED,thickness=10)
- Test your code by changing the variable values, and checking the boxes are still in the corners/center.
from gasp import *
begin_graphics(400, 300, title="Four corners", background=color.ORANGE)
Box((0,0),20,20,filled=False,color=color.RED,thickness=10) #At bottom left corner
Box((380,0),20,20,filled=False,color=color.RED,thickness=10) #At bottom right corner
Box((0,280),20,20,filled=False,color=color.RED,thickness=10) #At top left corner
Box((380,280),20,20,filled=False,color=color.RED,thickness=10) #At top right corner
Box((190,140),20,20,filled=False,color=color.RED,thickness=10) #At center
sleep(6)
end_graphics()
Agenda:
- Continue work on Robot game : due Thursday (2/10/11)
- Submit your code to school web lockers when you're done (semester 2) - please put your name at the top of your code.
- Small group review of the Debugging short exercise
- If you've complete & submitted Robot, review HTTLACS: Ch7 on strings. There are exercises to complete.
Friday (2/4/11)
Warmup:
- Review Robot grading rubric. See last slide of Media:Robot_game.pdf
Agenda:
- Continue work on Robot game : due Thursday (2/10/11)
- Lesson: Review debugging techniques
- Complete and submit the Debugging short exercise
- Closure
- Complete evaluation form
Wednesday - Thursday (2/2/11-2/3/11)
Warmup:
- The following code is supposed to wrap the player in Robot.
from gasp import *
begin_graphics(800, 600, title="Catch", background=color.YELLOW)
ball_x=-10
ball_y = 300
ball = Circle((ball_x, ball_y), 10, filled=True)
set_speed(120)
while True:
if ball_x<=0: # REPLACE WITH COMMENT
ball_x=800
elif ball_x>=800: # REPLACE WITH COMMENT
ball_x=0
move_to(ball,( ball_x,ball_y))
update_when('next_tick')
end_graphics()
- Copy and paste this code, and save it as a new program, and test it
- Next, replace the comments in the code with a description of what that section does
- Finally, write answers to the following questions, then discuss them with your partner:
- What behavior do you see?
- Why do you think this is happening (what's your hypothesis)?
- How could you test your hypothesis?
- How can you fix the code?
Agenda:
- Debrief warm up
- Debugging short exercise
- Continue work on Robot game : due Thursday (2/10/11)
- Closure
- Review Robot grading rubric. See Media:Robot_game.pdf
- Complete evaluation form
Monday (1/31/11) - Tuesday (2/1/11)
Warmup:
- Write a program that prompts the user for x and y coordinates between 0 and 200. Compare their input to a point at (75, 100). Tell the user if they are left or right of that point, and by how much. Likewise, tell them if they are below or above that point , and by how much.
Agenda:
- Media:Robot_game.ppt
- Complete Robot hand out
- Work on Robot game, even if you haven't finished Pong yet.
Monday - Tuesday (1/24/11 - 1/25/11)
Agenda:
- Continue working on Pong - aim to be finished this week.
- Work on Robot game. Use the 8.8 version of Catch!
- Once you have finished the core of the Robot assignment, complete the extension work.
Thursday - Friday (1/13/11 - 1/21/11)
Agenda:
- Begin working on Pong. Use the 8.10 version of Catch!
- If you complete Pong, then go onto the Robot game. Use the 8.8 version of Catch!
- NVCC Dual Enrollment
Tuesday - Wednesday (1/11/11 - 1/12/11)
Warmup:
- Without using the computer, what does the following code display?
from gasp import *
begin_graphics(width=800, height=600, title="Question 23")
x = 0
while x < 100:
Circle( (400, 300), x )
Line( (x, 0), (400, 300) )
x = x + 10
update_when('key_pressed')
end_graphics()
Agenda:
- 2nd Quarter Exam Make-ups
- Turn in any missing assignments
- Looping with GASP Exercises
- Following Game
- Begin working on Pong. Use the 8.10 version of Catch!
Friday - Monday (1/7/11 - 1/10/11)
Agenda:
- 2nd Quarter Exam
Wednesday - Thursday (1/5/11 - 1/6/11)
Agenda:
- 2nd Quarter Exam will be on...
- Period 1 - Friday (1/7/11)
- Period 2 - Monday (1/10/11)
- 2nd Quarter Exam Review
- input, output, variables, and math expressions
- functions
- function definitions
- function header
- function body
- return keyword
- if statements
- comparison operators
- ==
- !=
- <
- >
- <=
- >=
- Boolean operators
- and
- or
- combining Boolean operators
- comparison operators
- while loops
- sequences
- break keyword
- GASP
- Catch/Follow game
- Exam Format:
- Open and closed-book sections
- Multiple-choice
- Short-answer code
- Identify syntax errors
- Identify the purpose of code sections
- Begin working on Pong
Monday - Tuesday (1/3/11 - 1/4/11)
Warmup:
- Write a while loop that prints your name 10 times
Agenda:
- Winter Break debrief
- 2nd Quarter Exams Reminder
- Following Game Review
- Begin working on Pong