Spring 2012 Computer Programming I

= Course Description = An introduction to programming and problem solving. Topics include data types, variables, assignment, control structures (selection and iteration), structured data types, functions, and good program design.

Notes and lectures are based on Python Programming: An introduction to Programming by John Zelle

= Facebook Group = http://www.facebook.com/groups/308295055875865/

= Schedule = This schedule is tentative and subject to change as the course progresses. Please check back often to stay current on due dates and topics.

We will have several guest lectures throughout the semester.

Travel Information
I will attending two conferences during the semester. During these times, we will have guest lectures, exams, and activities. They will be for the following dates:
 * 02/29/2012 - 03/03/2012
 * 03/29/2012 - 03/31/2012

Week 1 - Jan 9, 11, 13
What is Python?

[http://prezi.com/npyiiiuzacqe/csci-220-welcome-to-programming-i/?auth_key=453e1f085953958bafa67798bdc877f99b0a57a6 Chapter 1. Computers and Programs]

Videos
1-11-2012 (download)

1-13-2012 (download)

Week 2 - Jan 16 (Holiday), 18, 20
Your first programs and IDE

Chapter 2. Writing Simple Programs

[[Media:Spring_2012_CSCI_220_Assignment_1.pdf|Assignment #1 Due by Friday at 5 PM]]

Using Python at the Windows command line

Videos
1-18-2012 (download)

1-20-2012 (download)

Week 3 - Jan 23, 25, 27
Data types

Chapter 3. Computing with Numbers

Exam #1 on Friday, [[Media:Spring_2012_CSCI_220_Practice_Exam_1.pdf|Practice Exam 1]], [[Media:Spring_2012_CSCI_220_Practice_Exam_1_Solutions.pdf|Practice Exam 1 Solutions]]

Highest precedence (anything in brackets is done first)

-x, +x +, - relational operators: <, >, <=, >=, !=, == logical not logical and logical or
 * (exponentiation)

Lowest precedence

Videos
1-23-2012 (download)

Week 4 - Jan 30, Feb 1, 3
Introduction to strings, graphics and objects

Chapter 5. Strings and Chapter 4. Objects and Graphics

[[Media:Spring_2012_CSCI_220_HW_2.pdf|Assignment #2 Due Monday, January 30 by 5 PM]]

graphics.py

Videos
1-30-2012 (download)

2-3-2012 (download)

Week 5 - Feb 6, 8, 10
Strings and Lists

Chapter 5. Sequences: Strings, Lists, and Files

[[Media:Spring_2012_CSCI_220_HW_3.pdf|Assignment #3 Due Friday, February 10 by 5 PM]]

Exam #2 on Friday February 10th, [[Media:Spring_2012_CSCI_220_Practice_Exam_2.pdf|Practice Exam]]

Videos
2-6-2012 (download)

2-8-2012 (download)

Week 6 - Feb 13, 15, 17
Functions

Chapter 6. Defining Functions

[[Media:Spring_2012_CSCI_220_Homework_4.pdf|Assignment #4 Due by Friday at 5 PM (Feb 17)]]

Code
def login(password,user): database_users = ["Paul","Luke","Pasha","Anna","Mac"] database_passwords = ["Anderson","Duvall","S","Bishop","Kimmerle"]

valid = False for i in range(len(database_users)): # Go through the database and check each user db_user = database_users[i] db_password = database_passwords[i] if db_user == user and db_password == password: valid = True return valid

def main: name = input("Enter your user name: ") pin = input("Enter your password: ") valid = login(pin,name) balance = 100 if valid == True: # if this is a valid user, print the following menu print("1. View balance") print("2. Withdraw money") choice = eval(input("Choice: ")) if choice == 1: print(balance)

main

Videos
2-13-2012 (download)

2-15-2012 (download)

2-17-2012 (download)

Week 7 - Feb 20, 22, 24
How do computers make decisions?

Chapter 7. Decision Structures

[[Media:Fall_2011_CSCI_220_Function_Conditionals.pdf|Function and Conditionals Worksheet]] [ [[Media:Fall_2011_CSCI_220_Function_Conditionals_Solutions.pdf|Solutions]] ]

[[Media:Fall_2011_CSCI_220_Function_Conditionals_Continued.pdf|Function and Conditionals Worksheet Continued]] [ Solutions ]

Exam #3, [[Media:Spring_2012_CSCI_220_Practice_Exam_3.pdf|Practice Exam 3]]

Videos
2-20-2012 (download)

2-22-2012 (download)

Week 8 - Feb 27, 29, Mar 2
More on decisions and functions

Making Tic Tac Toe

[[Media:Spring_2012_CSCI_220_Homework_5.pdf|Assignment #5 Due by Friday at 5 PM (Mar 2)]]

Videos
2-27-2012 (download)

2-29-2012 (download)

Week 9 - Mar 5, 7, 9
Spring Break

Week 10 - Mar 12, 14, 16
File I/O

File I/O from Chapter 5. Sequences: Strings, Lists, and Files

[[Media:Spring_2012_CSCI_220_Assignment_6.pdf|Assignment 6]], due Monday, March 12 by 5 PM.

Videos
3-12-2012 (download)

3-14-2012 (download)

3-16-2012 (download)

Week 11 - Mar 19, 21, 23
Loops

Chapter 8. Loop Structures and Booleans

Assignment 7, due Monday, March 19 by 5 PM.

Assignment 7 Solution

Solutions to #8 from the practice exam def findValidValue: while True: number = eval(input("Number: ")) if (number >= 6 and number <= 17) or number == 100 or (number > 20 and number < 25): break

return number

Exam #4 [[Media:Spring_2012_Practice_Exam_4.pdf|Practice Exam 4]] covering functions, conditionals, decision structures, and file I/O. Some practice exam solutions

Videos
3-19-2012 (download)

Week 12 - Mar 26, 28, 30
Sorting and searching algorithms

Chapter 13. Algorithm Design and Recursion

Assignment 8, due Monday, March 26 by 5 PM.

Videos
3-26-2012 (download)

3-28-2012 (download)

Week 13 - Apr 2, 4, 6
Sorting and searching algorithms

Chapter 13. Algorithm Design and Recursion

Videos
4-2-2012 (download)

4-4-2012 (download)

4-6-2012 (download)

Week 14 - Apr 9, 11, 13
Classes

Exam #5 on Friday, [[Media:Spring_2012_CSCI_Practice_Exam_5.pdf|Practice Exam #5]]

Week 15: Apr 16, 18, 20
Classes

Week 16: Apr 23

 * Flex/Review

Final Exam
Friday, April 27: 12 PM - 3 PM

Practice Final Exam

[[Media:Spring_2012_CSCI_220_Final_Exam.pdf|Clean version of the practice exam]]

We've converged on a plan for the scrabble game. Here is the run down: 1. Homework #9 is retracted. There will be no HW #9 2. You may use the completed Scrabble game (2 players, 2 machines) as a replacement for the class portion of the final exam. 3. You still have to take the rest of the exam. This only counts for that one section. 4. Due Monday, April 30 at midnight