Difference between revisions of "IB Computer Science 1"
From WLCS
Line 2: | Line 2: | ||
'''Warmup:''' | '''Warmup:''' | ||
# Create a list of lists like so: '''matrix = [ [2, 4, 6], [1, 3, 5], [0, 1, 2] ]''' | # Create a list of lists like so: '''matrix = [ [2, 4, 6], [1, 3, 5], [0, 1, 2] ]''' | ||
− | # Write a loop that goes from 0 up to len(matrix) | + | # Write a loop that goes from '''0''' up to '''len(matrix)''' using a counter variable '''r''' |
− | ## Inside the outer loop, write another loop that goes from 0 up to len(matrix[r]) | + | ## Inside the outer loop, write another loop that goes from '''0''' up to '''len(matrix[r])''' using a counter variable '''c''' |
### Print the element at '''matrix[r][c]''' | ### Print the element at '''matrix[r][c]''' | ||
# See if you can format the printing better | # See if you can format the printing better |
Revision as of 10:40, 22 March 2011
Contents
Tuesday (3/22/11)
Warmup:
- Create a list of lists like so: matrix = [ [2, 4, 6], [1, 3, 5], [0, 1, 2] ]
- Write a loop that goes from 0 up to len(matrix) using a counter variable r
- Inside the outer loop, write another loop that goes from 0 up to len(matrix[r]) using a counter variable c
- Print the element at matrix[r][c]
- Inside the outer loop, write another loop that goes from 0 up to len(matrix[r]) using a counter variable c
- See if you can format the printing better
Agenda:
- Nested lists
- 3rd Quarter Exam Review
- Basic stuff (variables, expressions, functions, if-statements, conditionals, loops)
- Strings
- Lists
- Convert one of your GASP games to use lists
- Demo your converted game by the end of next week
Monday - Friday (3/14/11 - 3/18/11)
Warmup:
- Demo your Advanced Python List Exercises
Agenda:
- Demo your Pig Latin Translator
- Item Collection Game w/ lists walkthrough
- Convert your Dodge game to use lists
Thursday (3/10/11)
Agenda:
- Make sure (Basic) Python List Exercises is turned in
- Advanced Python List Exercises
- Pig Latin Translator
Tuesday (3/8/11)
Warmup:
- Create a list with the following numbers: 6, 3, 8, 4, 3, 5, 4, 3, 2, 1, 6, 8, 9, 6, 7, 3, 7, 2, 5
- Create a variable named total and initialize it to 0 (zero)
- Use a loop to traverse the list
- Add each list element to the total
- Print out your total after the loop is done
Agenda:
- Final deadline: Dual enrollment forms are due (3/10/11)
- Make sure (Basic) Python List Exercises is turned in
- Advanced Python List Exercises
- How do we use lists to simplify our Dodge game?
- Example: If I have our warmup list, what would it look like to add 1 to every number?
- Example: What would it look like to multiply every number by 2?
- Example: What would it look like to reset all the numbers to 0?
Friday (3/4/11)
Warmup:
- Write the loop that finds the index of the first vowel
- Print out the index
Agenda:
- string.split()
- Pig Latin Translator
- (Basic) Python List Exercises
- Advanced Python List Exercises
Wednesday (3/2/11)
Warmup:
- Please fill out this survey
Agenda:
- Welcome back!
- List review
- (Basic) Python List Exercises
- Advanced Python List Exercises