Announcements

Weekly Schedule + Course Material

Week Day Date Partial Lectures Notes Readings Code and Examples
13 Fri August 03

- L31: Review. Final Review

Homework this week:

  1. Prepare for final exam.

Optional Readings and Videos

13 Wed August 01

- L30: Object Oriented Programming. (Note: This lecture is not included in the final exam.)ppt

Homework this week:

  1. Complete Tutorial 4 exercises.

Optional Readings and Videos

  1. coin_class.py
13 Mon July 30

- L29: Sorting. ppt

Homework this week:

  1. Add Canvas post by tonight, Monday, 1159pm. See lecture slide 10.
  2. Complete Tutorial exercises.
  • CMPT 120 Study Guide: Chapter 6.
  • Think Python. Appendix B: Analysis of Algorithms.

    Optional Readings and Videos

    12 Wed July 27

    - L28: Big O. ppt

    Homework this week:

    1. Submit assignment 4.
  • Think Python. Appendix B: Analysis of Algorithms.

    Optional Readings and Videos

    12 Wed July 25

    - L27: Searching. ppt

    Homework this week:

    1. Continue working on assignment 4.
  • CMPT 120 Study Guide: Chapter 6.
  • Optional Readings and Videos

    12 Mon July 23

    - L26: More Lists and Tuples. ppt

    Homework this week:

    1. A Canvas post is due by 11:59pm tonight. See Lecture slide 22
    2. Complate lab exercises.
    3. Continue working on assignment 4.
  • Think Python, Chapter 10: Lists .
  • Think Python, Chapter 12: Tuples .

    Optional Readings and Videos

    11 Fri July 20 - Quiz 2.

    - L26: More Lists and Tuples. ppt

    Homework this week:

    1. Complate lab exercises.
    2. Continue working on assignment 4.
  • Think Python, Chapter 10: Lists .

    Optional Readings and Videos

    11 Wed July 18

    - L25: A Quick Review - Main Concepts for Quiz 2. ppt

    Homework this week:

    1. Complate lab exercises.
    2. Prepare for Quiz 2: Lecture 14 to 23.

    Optional Readings and Videos

    11 Mon July 16

    - L24: Dictionaries in Python . ppt

    Homework this week:

    1. Complate lab exercises.
    2. Prepare for Quiz 2
  • Think Python, Chapter 11: Dictionaries .

    Optional Readings and Videos

    1. Code:birthdays.py
    2. Code:card_dealer.py
    10 Wed, Fri July 11, 13

    - L23: Using Files (Partial) . ppt

    - L23: Using Files (Complete) . ppt

    Homework this week:

    1. Submit Assignment 3 today, Friday, by 16:30 hrs.
    2. Complete lab exercises.
    3. Start working on Assignment 4.
    4. Class Participation July 13, due by tonight. See Lecture slide 26 for details. Think Python 2 - Exercise 9.1: Write a program that reads words.txt and prints only the words with more than 20 characters (not counting whitespace). Post your solution on Canvas by tonight Friday, 11:59pm.
  • Think Python: Sections 9.1, 14.1 to 14.5 Using Files for I/O.

    Optional Readings and Videos

  • Think Python, Chapter 14: Files .
    1. Code:File_IO_Demo_Read_File.py
    2. Code:File_IO_Demo_Write_to_File.py
    10 Mon July 9

    - L22: Recursive Functions. ppt

    Homework this week:

    1. Work on assignment 3.
  • Continue working on assignment 3.
  • Problem Solving with Algorithms and Data Structures using Python: Chapter 4. Recursion.

    Optional Readings and Videos

    09 Fri July 6

    - L21: Functions. ppt

    Homework this week:

    1. Work on assignment 3.
  • CMPT 120 Study Guide: Chapter 4: Functions and Decomposition.
  • math Module: Python documentation: math module.

    Optional Readings and Videos

    1. Turtle Graphics: Turtle Documentation.
    2. Turtle Examples: Examples.
    1. Article:Anatomy of a program in memory when it executes.
    2. Code:geometry.py
    3. Code:circle.py
    4. Code:rectangle.py
    09 Wed July 4

    - L20: Functions. ppt

    - L21_Developing_Programs_Using_Functions. - ppt.

    Homework this week:

    1. Work on assignment 3.
  • CMPT 120 Study Guide: Chapter 4: Functions and Decomposition.
  • Think Python 2: Chapter 4 - Case Study: Interface Design
  • Optional Readings and Videos

    1. Turtle Graphics: Turtle Documentation.
    2. Turtle Examples: Examples.
    1. Article:Anatomy of a program in memory when it executes.
    2. Code:AreaCalculator_Comments.py
    3. Code:AreaCalculator_1.py
    4. Code:AreaCalculator_2.py
    5. Code:AreaCalculator_3.py
    6. Code:AreaCalculator_4.py
    09 Mon July 2

    - Holiday - Canada Day



    08 Fri June 29

    - Midterm today.
    - Assignment 3 released.

    Homework this week:

    1. Work on assignment 3.
  • CMPT 120 Study Guide: Chapter 4: Functions and Decomposition.
  • Think Python 2: Chapter 4 - Case Study: Interface Design
  • Optional Readings and Videos

    1. Turtle Graphics: Turtle Documentation.
    2. Turtle Examples: Examples.
    1. Python Code Visualizer
    08 Wed June 27

    - L19: Turtle Graphics, and Functions. (Partial): ppt.

    L19: Turtle Graphics, and Functions. (Complete) - ppt.

    Homework this week:

    1. Work on assignment 2.
    2. Practice writing code on paper in prepration for the midterm.
  • CMPT 120 Study Guide: Chapter 4: Functions and Decomposition.
  • Think Python 2: Chapter 4 - Case Study: Interface Design
  • Optional Readings and Videos

    1. Turtle Graphics: Turtle Documentation.
    2. Turtle Examples: Examples.
    1. Python Code Visualizer
    2. AreaCalculator_1.py
    3. Turtle_Lab_5.py
    08 Mon June 25

    - L18: Integer Data Representation - 2's Compliment (Partial): ppt.

    L18: Integer Data Representation:. (Complete) - ppt.

    Homework this week:

    1. Class Participation June 25, due by tonight. See Lecture slide 24 for details: Perform 2's Complimention addition and post your solution on Canvas by tonight Friday, 11:59pm.
    2. Work on assignment 2.
    3. Prepare for Midterm: In class, written exam, 2 coding questions. Duration: 45 Minutes. Practice writing small programs on paper. ay particular attention to user input, string methods/functions, if-else, operators (logical, membership etc,), list/string iterations using for-loop, range, sum/counting inside loop etc.

      In addition to the lecture slides, labs, and other preparation you might want to do, read and practise examples from the chapters 1,2,5,7 and 8 of the Think Python 2.

      Sample Questions for Midterm Practice:
      1. Ask the user for a string and print out whether this string is a palindrome or not. (A palindrome is a string that reads the same forwards and backwards.)
      2. Create a program that asks the user to enter their name and their age. Print out a message addressed to them that tells them the year that they will turn 100 years old. Ensure that the first letter of the name is printed in uppercase.
      3. Write a Python program to remove punctuations from a string entered by the user. Check each character of the string using for loop. If the character is a punctuation, assign an empty string to it.
      4. Write a program that accepts sequence of words as input and prints the words after making all characters in the sentence capitalized.
  • CMPT 120 Study Guide: Topic 2.6 How Computers Represent Information; 3.9 More About Algorithms / Binary Conversion
  • How to Think Like a Computer Scientist: Learning with Python 3:Topics 3.8 Converting Decimal Numbers to Binary Numbers
  • Optional Readings and Videos

    1. A Tutorial on Data Representation
    1. Python Code Visualizer
    07 Fri June 22

    - L17: Integer Data Representation (Partial): ppt.

    L17: Integer Data Representation:. (Complete) - ppt.

    Homework this week:

    1. Class Participation June 22, due by tonight. See Lecture slide 28 for details: Perform 1's Complimention addition and post your solution on Canvas by tonight Friday, 11:59pm.
    2. Finalize groups for assignment 2.
    3. Work on assignment 2.
  • CMPT 120 Study Guide: Topic 2.6 How Computers Represent Information; 3.9 More About Algorithms / Binary Conversion
  • How to Think Like a Computer Scientist: Learning with Python 3:Topics 3.8 Converting Decimal Numbers to Binary Numbers
  • Optional Readings and Videos

    1. A Tutorial on Data Representation
    07 Wed June 20

    - L16: Binary Representation/Encoding: ppt.

    Homework this week:

    1. Finalize groups for assignment 2.
    2. Work on assignment 2.
  • CMPT 120 Study Guide: Topic 2.6 How Computers Represent Information; 3.9 More About Algorithms / Binary Conversion
  • How to Think Like a Computer Scientist: Learning with Python 3:Topics 3.8 Converting Decimal Numbers to Binary Numbers
  • Optional Readings and Videos

    1. A Tutorial on Data Representation
    07 Mon June 18

    - L15: Binary Representation/Encoding. (Partial): ppt.

    L15: Binary Representation/Encoding. (Complete) - ppt.

    Homework this week:

    1. Prepare for the Quiz 1 on Wednesday, June 20. The quiz contains multiple choice questions only. No program writing questions. Go through Readings, lectures slide, and labs to refresh the computing science and programming concepts
  • CMPT 120 Study Guide: Topic 2.6 How Computers Represent Information; 3.9 More About Algorithms / Binary Conversion
  • How to Think Like a Computer Scientist: Learning with Python 3:Topics 3.8 Converting Decimal Numbers to Binary Numbers
  • ASCII: ASCII Codes Table
  • Unicode: Unicode Table
  • Optional Readings and Videos

    1. ASCII
    2. Unicode
    06 Fri June 15

    - L14: Control Structures:while loop. Partial): ppt.

    - In-Class Practice Questions to help you prepare for the Quiz 1 on Wednesday. (10 minutes. No marks).

    L14: Control Structures:for loop. In-Class Coding (Complete) - ppt.

    Homework this week:

    1. Prepare for the Quiz 1 on Wednesday, June 20. The quiz contains multiple choice questions only. No program writing questions. Go through Readings, lectures slide, and labs to refresh the computing science and programming concepts
  • Think Python: Chapter 7.
  • CMPT 120 Study Guide: Chapter 3: Topic 3.3 to 3.5
  • Think Python: Chapter 7.
  • How to Think Like a Computer Scientist: Learning with Python 3:Topics 7.4 and 7.8
  • Optional Readings and Videos

    1. for loop: Python for Loop Statement
    06 Wed June 13

    L13: Control Structures:while loop, In-Class Coding. (Partial): ppt.

    L13: Control Structures:while loop, In-Class Coding (Complete) - ppt.

    Homework this week:

    1. Class Participation June 13, due by tonight. See Lecture slide 20 for details: Write a Python program to print a multiplication table using the while loop and upload on Canvas by tonight Monday, 11:59pm.
    2. Read and try the examples (The Collatz 3n + 1 sequence, Tracing a program, Counting Digits ):Examples: 7.5-7.7
  • Think Python: Chapter 7.
  • CMPT 120 Study Guide: Chapter 3: Topic 3.3 to 3.5
  • Think Python: Chapter 7.
  • How to Think Like a Computer Scientist: Learning with Python 3:Topics 7.4 and 7.8
  • Optional Readings and Videos

    1. for loop: Python for Loop Statement
    06 Mon June 11

    L12: Control Structures:for loop, In-Class Coding. (Partial): ppt.

    L12: Control Structures:for loop, In-Class Coding (Complete) - ppt.

    Homework this week:

    1. Class Participation June 11, due by tonight. See Lecture slide 20 for details: Write a Python program to print a multiplication table using a for loop and upload on Canvas by tonight Monday, 11:59pm.
  • Think Python: Chapter 4: Topic 4.2, Chapter 7.
  • CMPT 120 Study Guide: Chapter 3: Topic 3.2.
  • How to Think Like a Computer Scientist: Learning with Python 3:Topics 3.3, 7.1 and 7.2.
  • Optional Readings and Videos

    1. while loop: Python while Loop Statement
    05 Fri June 8

    L11: String Methods, Control Structures:if-elif-else Practice - ppt.

    Homework this week:

    1. Class Participation June 8, due by tonight. See Lecture slide 14: Modify the Simple Calculator program you wrote in the class today to add a while loop. Exit the loop when the user enters 0 to end the program. Post your code on the Canvas by tonight Friday, 11:59pm.
  • Think Python: Chapter 5: Topic 5.1, 5.4 - 5.7, Chapter 10: 10.9 Lists and strings.
  • CMPT 120 Study Guide: Chapter 3: Topic 3.1.
  • How to Think Like a Computer Scientist: Learning with Python 3:Chapter 3.3; Cahapter 7
  • Optional Readings and Videos

    1. ListsLists in Python
    2. Basic formattingPyFormat
    05 Mon, Wed June 4 - 6

    L10: String operations, Control Structures:if-elif-else (Partial) - ppt.

    L10: String operations, Control Structures:if-elif-else (Complete) - ppt.

    Homework this week:

    1. Pratice only. Write Pyrhon 3 program for the Simplified Guessing Game algorithm given in Figure 3.1 of the Study Guide.
    2. Class Participation June 6, due by tonight. See Lecture slide 34: Input a number from the user. Use the if, elif, and else statements to check if the number is:
      1. positive, or
      2. Negative, or
      3. zero.
      4. Display an appropriate message.
  • Think Python: Chapter 5: Topic 5.4 - 5.7; Chapter 8.
  • CMPT 120 Study Guide: Chapter 3: Topic 3.1.
  • How to Think Like a Computer Scientist: Learning with Python 3:Strings
  • Basic formattingPyFormat
  • Optional Readings and Videos

    04 Mon, Wed, Fri May 28-June 1

    L09: I/O functions, Types, Operator Precedence, String operations (Partial) - ppt.

    L09: I/O functions, Types, Operator Precedence, String operations (Complete) - ppt.

    Homework this week:

    1. Pratice only. Write Pyrhon program to display first letter of your name. The letter should be displayed in 9 rows and 9 columns, and formed using *s only. Hint: You may use \t and \n, or any other formatting.
    2. Practice only: Write Pyrhon code to simulate a basic calculatior, which can add, subtract, multiply, or divide two numbers. You would input the numbers from user. You also ask user to specify the arithematic operation to be performed. Finally, display both the numbers and their result. You may use %d, %s, \t and \n, or any other formatting.
    3. Class participation. (Due tonight): Add comments to the attached program (as shown on lecture slide 23: Comment Your Programs: Sample) and post it on the Canvas Discussion forum by tonight 11:59pm. (Note: You would comment all your future programs in the same way. Try to create your personalized comments template, and save it on your computer.) add2.py
  • Think Python: Chapter 2 (full); Chapter 3: Sections 3.1, 3.7
  • CMPT 120 Study Guide: Chapter 2 (minus: How Computers Represent Information)
  • Optional Readings and Videos

    1. Input and Output Examples: Python Input, Output and Import
    2. Input and Output Examples: Python Programming/Input and Output
    3. Basic formattingPyFormat
    03 Fri May 25

    L08: Logical Operators, Variables, Statements (Partial) - ppt.

    L08: Logical Operators, Variables, Statements (Complete) - ppt.

    Homework this week:

    1. For practice only. Not to be submitted.
      Suppose the cover price of a book is $24.95, but bookstores get a 40% discount. Shipping costs $3 for the first copy and 75 cents for each additional copy. Write a python program to compute total wholesale cost for given (input from user) number of copies?.
  • Think Python: Chapter 2.1-2.9, Section 5.1 to 5.3
  • Optional Readings and Videos

    1. Python Operators
    03 Wed May 23

    L07: Programming (Partial) - ppt.

    L07: Programmng (Complete) - ppt.

    Homework this week:

    1. Modify, run, and reflect on the grade version 2 program. See lecture slide 26 for details. grade_version2.py
  • Think Python: Section 2.1 to 2.3, Section 5.1 to 5.3
  • Optional Readings and Videos

    1. Python Operators
    02 Fri May 18

    L06: Programming (Partial) - ppt.

    L06: Programmng (Complete) - ppt.

    Homework this week:

    1. Complete and run the attached grades claculation program. (Use the grade_base.py code provided here.) Test you program for each case. grade_base.py
    2. Run the sum of first 100 natural numbers program. Modify the code to get the value of n from user. sum100.py
  • Think Python: Chapter 1 - The way of the program.
  • CMPT 120 Study Guide: Topic 2.1 to 2.3
  • Optional Readings and Videos

    1. Python Operators
    02 Wed May 16

    L05: Programmng (Partial) - ppt.

    L05: Programmng (Complete) - ppt.

    Homework this week:

    1. Find Smallest From 3 Numbers: Add post on Canvas Discussions forum after the class today and before 11:59pm tonight.

    2. Exercises: Think Python: Chapter 1, Section 1.9.
  • Think Python: Chapter 1 - The way of the program.
  • CMPT 120 Study Guide: Topic 1.3.
  • Optional Readings and Videos

    1. IDLE Video
    02 Mon May 14

    L04: Pseudocodes (Partial) - ppt.

    L04: Pseudocodes (Complete) - ppt.

    Homework this week:
    Get a CSIL Access fob, if you have not done it already. Here is how to get it.

  • CMPT 120 Study Guide: Topic 1.4.
  • Optional Readings and Videos

    1. Video: Pseudocode
    2. Pseudocode - Advantages and Limitations
    01 Fri May 11

    Lecture 3: Flowcharts (Partial) - ppt.

    Lecture 3: Flowcharts (Complete) - ppt.

    Homework this week:
    Get a CSIL Access fob, if you have not done it already. Here is how to get it.

    Draw flowchart for finding the smallest among the three numbers.
    What is a Flowchart? Tutorial

    Optional Review
    A review Flowcharting tools: Software Tools

    01 Wed May 9

    Lecture 2: Algorithms (Partial) - ppt.

    Lecture 2: Algorithms (Complete) - ppt.

    Homework this week:
    Get a CSIL Access fob, if you have not done it already. Here is how to get it.

    Date extended till 11:59pm tonight for adding the lecture 1 posts on Canvas Discussions forum.
  • CMPT 120 Study Guide: Unit 1, Section 1.1, and 1.2.
  • Optional Readings and Videos

    1. A video: What Is a Programming Algorithm?
    2. An Internet resource: Background: Algorithms
    3. Qualities of good algorithms and simple examples: Algorithm in Programming
    4. Which are the 10 algorithms every computer science student must implement at least once in life? 10 Algorithms for Every CS Student
    5. 10 algorithms that rule the world What is an algorithm
    01 Mon May 7

    L01: Introdution (Partial) - pdf

    L01: Introduction(Complete) - pdf

    Homework this week:
    Get a CSIL Access fob. Here is how to get it.

    Add posts on Canvas Discussions forum after the class today and before 11:59pm tonight.

    Optional Readings and Videos:
    Sections 1.1 and 1.2 in "Starting out with Programming Logic and Design", by T. Gaddis, 2016 Gaddis-ch1-pp1-20.

    Students use of laptops in class lowers grades.

    Big Picture of Computing Systems as layers: Chapter 1, Computer Science Illuminated, by N. Dale and J. Lewis, Jones and Bartlett publishers, 2007.  [This book and in particular this chapter are available at the library on reserves] 

    What is Computer Science?

    Why Python (watch from start to 6:00): Talk by Jessica McKellar.