Uploaded by vanessashume

CCPS 109 Course Outline

advertisement
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
CCPS 109 Computer Science I
TABLE OF CONTENTS
COURSE OVERVIEW
3
COURSE DESCRIPTION
COURSE FOCUS AND SCOPE
COURSE LEARNING OUTCOMES
TEACHING METHODS
3
3
3
4
COURSE SCHEDULE
5
MODULE 1
MODULE 2
MODULE 3
MODULE 4
MODULE 5
MODULE 6
MODULE 7
MODULE 8
MODULE 9
MODULE 10
MODULE 11
MODULE 12
LAST DAY OF THE COURSE
6
8
10
12
14
16
18
20
22
24
26
28
30
COURSE TEXTBOOK(S) AND MATERIALS
31
REQUIRED TEXTBOOK(S)
RECOMMENDED READINGS OR RESOURCES
31
31
ASSESSMENT AND EVALUATION
31
MARKING SCHEME
ASSIGNMENT DESCRIPTIONS
PARTICIPATION DETAILS
ETIQUETTE GUIDELINES
LATE ASSIGNMENTS, MISSED TERM WORK OR EXAMINATIONS AND COURSE REPEATS
PLAGIARISM
32
33
33
35
36
37
OTHER COURSE INFORMATION
38
DEPARTMENTAL POLICIES AND COURSE PRACTICES
ACCESSIBILITY
SPECIFIC DETAILS ON IT REQUIREMENTS
RYERSON STUDENT EMAIL
STUDENT SUPPORT
38
39
39
39
41
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 1
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Course Overview
Course Description
An introductory programming course designed to introduce fundamental Computer Science
concepts such as abstraction, modelling and algorithm design. Emphasis is placed on
producing correct software.
Course Focus and Scope
This course is an introduction to computer science and programming using the Python programming
language. It gives students the ability to read, write and understand small Python functions that consist
of the core language and its data structures, and break down abstract problems into Python structures
to solve them.
Course Learning Outcomes
Upon the successful completion of this course, students will be able to:
●
Understand the structure and syntax of Python programming language,
●
Create, edit, run, test and debug small functions written in Python.
●
Design and test short functions (at most about two dozen lines of code, usually less) in Python
to solve small computational problems that do not need to maintain any additional state to
remember what has happened in the past.
Teaching Methods
This course relies heavily on lecture notes and example programs developed by the instructors. There
is no textbook to purchase, since all course materials are freely available online, including the existing
documentation of the Python language and its standard libraries. The software needed in this course is
also free to download and use, and can be installed either on the local computer or used on the cloud
through the web browser.
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 2
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
The first four weeks of the course introduce the core Python language to the extent that is sufficient for
the needs of this course. This core language is drilled in with the CodingBat training site that lets
students try their hand in writing lots of little functions interactively for immediate evaluation.
For the actual graded lab work that is done in this course from the fifth week onwards, the instructors
provide a Python script that automatically tests each student-written function for its correctness over a
large number of test cases. Students are therefore at all times fully aware of how far they have
progressed in the course. When some of the functions that they wrote are not working correctly, the
automated tester script can also help pinpoint the discrepancy.
The YouTube playlist “CCPS 109 Computer Science I” contains lecture videos created by Ilkka
Kokkarinen to cover all the theoretical topics and most of the examples in this course. The videos show
the use of all these systems in practice, with the discussion of the examples and what they individual
minor and major details mean.
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 3
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Course Schedule
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 4
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Week 1
Module 1
Python as scriptable calculator
Topics
●
●
●
●
●
●
●
Launching the Python interactive environment either locally or on the cloud.
Entering arithmetic expressions inside the Python REPL.
Defining names that are associated with values, and using these names inside later expressions.
Basic operations of integer arithmetic, with a suggestion to avoid floating point numbers in your work if
possible.
Importing new functions from the standard library modules and using them in your computations.
Representing text as string literals in Python.
Composing complex text strings from simpler pieces with the f-string mechanism.
Learning Objectives
By the end of this module…
●
●
●
●
●
●
Students can launch the Python interactive environment either on their local computer
(Anaconda/Spyder/Jupyter) or on the cloud (repl.it).
They know how to evaluate arbitrary arithmetic expressions in the REPL window, and how integer
arithmetic operators work in Python.
They can create names that remember values that were assigned to them, and use these names in later
expressions to refer to results that were calculated earlier.
They can open, edit, save and execute scripts in some Python IDE, and can make these scripts print results
for the user to see.
They can define text literals as ordinary and f-strings in Python.
They can import new functions and data types from the standard library into their scripts, and know where
to go in the official Python documentation to learn how to use these functions in their code.
Readings
Required Readings
●
"Python Lecture Notes", sections "1.1. Expressions", "1.2. Scripts", "1.3. Naming things", "1.4. Assignment
operator", "1.5. Types", "1.6 Importing functionality from modules", "1.7. Some useful standard library
modules".
Recommended Readings
●
GitHub repository ikokkari/PythonExamples: first.py
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 5
Course Title
Course Code
CECL
Email
●
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
YouTube playlist "CCPS 109 Computer Science I, Python" videos: "Python 1-1: Overview", "Python 1-2:
And God created integers", "Python 1-3: Give me a name instead of a number", "Python 1-4: Executable
text".
Assignments
During the first four modules, this course uses the excellent CodingBat Python interactive training site. This site
contains lots of small programming problems whose purpose is to drill in the core Python language that we learn
during the first four weeks. To learn to use the CodingBat environment with the little Python language we have so
far, solve the problem hello_name from the section String-1.
Tests/Exams
N/A
Learning and Engagement Strategies (Course Planning Area) for Week 1
The purpose of this first module is to get acquainted with the Python Interactive Development Environment
(IDE) in which the Python programs are created and executed. Instead of the old-school installation straight from
the source at www.python.org, students who choose to work locally on their own computers can download and
install the Anaconda package manager, and do their work inside the Spyder IDE there. Alternatively, students
may choose to work on a cloud-based Python environment repl.it that can be accessed anywhere via a web
browser. All examples, exercises and lab problems in this course can quite well be completed in either
environment.
Option 1 (Anaconda/Spyder locally): Download and install Anaconda Individual Edition. While this behemoth
is installing, you might as well use that waiting time to download the entire repositories ikokkari/PythonExamples
and ikokkari/PythonProblems as zip archives (use the green Clone/Download button), and unzip these archives
into folders PythonExamples and PythonProblems into whatever place in your file system you normally
store your data files. Start up Anaconda, and from there start Spyder. (In the first run, both of these might be a
bit sluggish to start up, but they will get there.) Use File->Open... to open the script first.py into an editor
window. Press the green play button to execute the script whose editor window is currently active. Observe the
results in the console window. When this script asks you to enter your name and age, give it something so that
the script can proceed.
Option 2 (repl.it on the cloud): Create yourself a free account on the site repl.it under which your files will be
stored under. Click the black "import repo" button on the top right corner, enter the URL
"https://github.com/ikokkari/PythonExamples" into the dialog box and click "Import from
GitHub". You should now see a Python 3 "repl" named PythonExamples under your account that contains all
the
example
programs
from
this
course.
Do
the
same
for
the
URL
"https://github.com/ikokkari/PythonProblems" to import the automated testing environment for the
lab problems for this course. Go to the PythonExamples repl and press the green "Run" button to execute the
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 6
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
script first.py. When the script asks you to enter your name and age, give it something so that the script can
proceed. To make the "Run" button execute some other script, you have to edit the second line of the file
.replit to read run="python3 scriptname.py" where you should replace scriptname with the actual
name of the script that you want to run.
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 7
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Week 2
Module 2
Functions that make decisions
Topics
●
●
●
●
●
●
Defining your own functions that compute and return a result that depends on the function arguments.
Purpose of whitespace to indicate nesting of statements inside a Python script.
Two-way decisions to branch the execution of a script into two mutually exclusive branches based on the
truth value of some condition.
Equality and order comparisons in Python.
Building up larger decision trees from two-way decisions via nesting and laddering.
Expressing more complex conditions with logical connectives.
Learning Objectives
By the end of this module…
●
●
●
●
●
Students are able to first define functions in their scripts, and then call these functions properly later in the
code using different argument values.
They understand the difference between the function printing the result versus returning it.
They can explain the connection of the whitespace indentation that starts a Python statement and the nesting
of that statement inside the Python script.
They can make their functions perform simple two-way if-else statements, and combine these two-way
decisions into more complex decision trees by nesting them and creating if-else ladders.
They recognize the logical connectives and, or and not, and explain how the truth value of a condition
built with these depends on the truth values of its sub conditions.
Readings
Required Readings
●
"Python Lecture Notes", sections "2.1. Defining your own functions", "2.2. Simple two-way decisions",
"2.3. Complex conditions", "2.4. If-else ladders".
Recommended Readings
●
●
GitHub repository ikokkari/PythonExamples: conditions.py timedemo.py
YouTube playlist "CCPS 109 Computer Science I, Python" videos: "Python 2-1: Verb every word to me",
"Python 2-2: Forks on the road", "Python 2-3: The Galton board of reality", "Python 2-4: A Skinner box
for humans, localized entirely within your computer", "Python 2-5: Once in a century".
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 8
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Assignments
The problems in the three CodingBat Python sections Warmup-1, Logic-1 and Logic-2 will have you write functions
that cover all possible situations of their argument values with a small handful of decisions properly nested and
laddered. Your task this week is to solve at least ten problems of your choice from these three sections. This
ought to drill the Python syntax (including that annoying redundant colon after every condition, and that == and =
are different things, as are also // and /) into your fingertips, while at the same time your mind gets accustomed to
the task of breaking down a complex decision into a decision tree made of simple two-way decisions.
Tests/Exams
N/A
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 9
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Week 3
Module 3
Sequence types string, list and tuple
Topics
●
●
●
●
●
Embedding special characters inside string literals with escape sequences.
The slicing operator for Python sequences, as demonstrated by slicing pieces from existing text strings.
Strings as immutable sequences of Unicode characters.
The structurally flexible and heterogeneous lists in Python.
Constructing new list objects from existing sequences with list comprehensions.
Learning Objectives
By the end of this module…
●
●
●
●
Students know how to build up text string literals that can contain arbitrary Unicode characters.
They can slice and dice text strings and other sequences forwards and backwards with the slicing operator
[] of Python.
Their ability to represent data has expanded from scalar values to encompass sequences of arbitrary values
as Python lists.
Students can take an existing list and transform it into a new list with list comprehensions.
Readings
Required Readings
●
"Python Lecture Notes", sections "3.1. String literals from Unicode characters", "3.2. String literals from
arbitrary pieces", "3.3. String slicing", "3.4. Lists made of things" and "3.5. List comprehensions".
Recommended Readings
●
●
GitHub repository ikokkari/PythonExamples: listdemo.py stringdemo.py comprehensions.py
tuples.py
YouTube playlist "CCPS 109 Computer Science I, Python" videos: "Python 3-1: It slices, it dices, and so
much more!", "Python 3-2: Pretty objects all in a row", "Python 3-3: All sequences eager and lazy", "Python
3-4: Definition of terse"
Assignments
To practice handling sequences of data and learn to understand how these sequences can be freely sliced into smaller
pieces and concatenated into larger pieces, CodingBat sections Warmup-2, String-1 and List-1 contain a host of
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 10
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
excellent problems ready to be solved with the Python language learned in this week's module. Your task, same as
last week, again is to drill in the language syntax into your fingertips while your mind adapts to think about entire
sequences of data of unlimited length instead of mere individual scalar values. Therefore, this week you should
again complete at least ten, but preferably more, problems chosen from these three sections.
Tests/Exams
N/A
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 11
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Week 4
Module 4
Sequence iteration
Topics
●
●
●
●
●
●
Iterating through the elements of an arbitrary sequence with the same for-loop.
Lazy sequences that produce their elements one at the time on command.
The extremely memory-efficient range sequences for the commonly needed arithmetic progressions of
integers.
Files as sequences of lines, each line a sequence of characters.
Tuples as compact immutable sequences of a handful of elements.
Sets and dictionaries that are used to remember the things that the function has seen and done.
Learning Objectives
By the end of this module…
●
●
●
●
●
Students can write for-loops to iterate through the elements of the given sequence, and have the body of the
for-loop perform the same computation for each element
This computation can involve updating the local state of the function such as tallying up the sum or the
maximum of the elements seen so far.
They know how to represent arithmetic progressions as range objects, and understand why such a range
requires far less memory to store compared to an eager list that contains its elements explicitly.
They know the difference between mutable lists and immutable tuples, and which operations are possible
based on that.
Students can create a fresh new set and use it to store the values encountered during the function execution,
and can explain why asking a set whether it currently contains some element is much faster than asking the
same question from a list.
Readings
Required Readings
●
"Python Lecture Notes", sections "4.1. Processing items individually with for-loops", "4.2. Iterator objects",
"4.3. Integer sequences as range objects", "4.4. Files as sequences", "4.5. Tuples as immutable sequences",
"4.7. Members only", "4.8. From keys to values". (Students looking for extra reading can also check out
sections "4.6. Breaking tuples into components" and "4.9. Assorted list, set and dictionary goodies", but
these topics are not required in this course.)
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 12
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Recommended Readings
●
●
GitHub repository ikokkari/PythonExamples: defdemo.py setsanddicts.py wordcount.py
YouTube playlist "CCPS 109 Computer Science I, Python" videos: "Python 4.1: For your elements only",
"Python 4-2: Memory of a goldfish", "Python 4-3: Frank Benford, gumshoe who works scale", "Python 44: Those who can't remember the past...", "Python 4-5: Memories of lit"
Assignments
After this module, students can confidently face the problems in the CodingBat Python sections String-2 and List2. These problems require the use of some for-loop to process the elements of the given string or a list.
Tests/Exams
N/A
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 13
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Week 5
Module 5
General repetition
Topics
●
●
●
●
●
Using a while-loop to repeat the body of statements until the desired goal is reached.
Finite and infinite loops.
The optional else-block after a Python loop.
Binary search to narrow down even an astronomical number of possibilities to just one.
Breaking out of the execution of a loop, or just skipping directly to the next round.
Learning Objectives
By the end of this module…
●
●
●
●
●
Students know the syntax and use of the general repetition structure of a while-loop in Python for situations
where it is not known in the beginning how many times the loop body should be executed to achieve the
goal of the problem.
They know that an infinite loop is an actual possibility, just like doing nothing is another possibility that
we don't often think about in real world systems biased towards action.
They recognize the optional else-block after a Python loop and its behaviour in functions written by other
people.
They know the binary search algorithm when applied to searching inside a sorted random access sequence,
and can use the implementation in the Python standard library.
They know the effect of the break and continue statements inside the loop and can use them in their
own functions, but with the knowledge that doing so is never necessary and is in fact impure in the
structured programming spirit.
Readings
Required Readings
●
"Python Lecture Notes", sections "5.1. Unlimited repetition", "5.2. While not there yet, take one more step
towards it", "5.3. Binary search", "5.4. The power of repeated halving", "5.5. Nested loops".
Recommended Readings
●
GitHub repository
hangman.py
ikokkari/PythonExamples:
mathproblems.py
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
cardproblems.py
Page 14
Course Title
Course Code
CECL
Email
●
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
YouTube playlist "CCPS 109 Computer Science I, Python" videos: "Python 5-1: Are we there yet?",
"Python 5-2: Straight and narrow road", "Python 5-3: A handful of symbolism", "Python 5-4: Cold as the
cards lie", "Python 5-5: A crooked little pair"
Assignments
Having gained the understanding of how the automated tester works and what its various messages mean for the
functions being tested, we can start working with the graded labs. The first three lab problems from the collection
"109 Python Problems for CCPS 109" were chosen as the material for this week are:
1. Ascending list (is_ascending)
2. Cyclops numbers (is_cyclops)
3. Suppressed digit sum (suppressed_digit_sum)
Tests/Exams
N/A
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 15
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Week 6
Module 6
Some educational example scripts
Topics
●
●
●
●
●
Reading in data encoded in the JSON standard format for representing structured data, and processing it
with Python.
Writing functions to solve problems in a problem domain of playing cards and some familiar games that
are played with them.
The global keyword that allows your function to talk about data in the same module.
Having a while-loop run around a large problem space looking for a goal that satisfies our expectations for
the given problem.
Using custom sorting criteria with the optional key function given to sort function.
Learning Objectives
By the end of this module…
●
●
●
●
●
Students have gained additional confidence in breaking an abstract and vague idea systematically down
into Python operations.
Students know how to import data from JSON files to give our programs something interesting from the
real world to deal with instead of just always doing everything with made-up numbers.
They know the mechanism to make their functions remember things by naming these things outside the
function in the same module so that they continue to exist even between calls.
They can modify the standard sort function to use a custom sorting criteria by giving it the optional key
function, and create such key functions as one-liners with lambda expressions.
They understand the concept of testing a function with previously designed test cases whose expected
results are compared to the results returned by the function.
Readings
Required Readings
●
"Python Lecture Notes", sections "6.1. Different levels of programming errors", "6.2. Software testing",
"6.3. Designing good test cases", "6.4. JSON".
Recommended Readings
●
GitHub repository ikokkari/PythonExamples:
mountains.py specialnumbers.py
stringproblems.py
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
countries.py
Page 16
Course Title
Course Code
CECL
Email
●
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
YouTube playlist "CCPS 109 Computer Science I, Python" videos: "6-1: Some hazards we know", "6-2:
Loop and a half men", "6-3: Powerful words", "6-4: On the primal side".
Assignments
For this module, another three graded labs were chosen from the collection "109 Python Problems for CCPS 109"
to function as our training ground and a confidence course:
1. Three summers ago (three_summers)
2. Nearest smaller element (nearest_smaller)
3. What do you hear, what do you say? (count_and_say)
Tests/Exams
N/A
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 17
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Week 7
Module 7
Lazy sequences
Topics
●
●
●
●
The fundamental difference between lazy and eager sequences, and the advantages and downsides of each
representation.
Defining lazy sequences easily with generator functions that yield their results one at the time.
Generator decorators that can be applied to transform an existing sequence into some different lazy
sequence.
The highly useful generator decorators of the Python itertools module.
Learning Objectives
By the end of this module…
●
●
●
●
After this module, students can explain the difference between eager and lazy sequences, and what type of
situations each kind of sequence is appropriate.
They know how to turn their ordinary functions to print out values into generators that yield these same
values one at the time for further processing.
They are aware of the Python itertools module and can explain its general purpose, and can consult the
documentation to use the decorators islice and takewhile to turn an infinite lazy sequence into a finite
one.
They know how to consult the same documentation to use the combinatorial generators in the standard
library itertools module to loop through all possible pairs, triple, subsets, permutations and other basic
combinations of an existing sequence such as a deck of playing cards.
Readings
Required Readings
●
"Python Lecture Notes", section "7.1. Generators".
Recommended Readings
●
●
GitHub repository ikokkari/PythonExamples: generators.py reservoir.py hamming.py
YouTube playlist "CCPS 109 Computer Science I, Python" videos: "7-1: To get all I deserve and to give
all I can", "7-2: Let George do it", "7-3: Zero knowledge"
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 18
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Assignments
The three lab problems chosen for this week from the collection "109 Python Problems for CCPS 109" continue the
theme of dealing with sequences with more complicated operations that have to combine ideas from previous
lectures.
1. Revorse the vewels (reverse_vowels)
2. Once I zig, you gotta zag (create_zigzag)
3. Bulgarian solitaire (bulgarian_solitaire)
Tests/Exams
N/A
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 19
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Week 8
Module 8
Recursion
Topics
●
●
●
●
●
●
Self-similarity of computational problems as the key to unlock the recursive implementation to solve that
problem.
Downsides of recursion compared to solving that same problem with loops.
Recursions that branch into two or more directions to solve the original problem.
Branching recursion to explore an exponential space of solutions.
Decorating functions with functions in Python.
Recursions that take exponential time due to needlessly solving the same subproblems, and how such wild
recursions are tamed with memoization using @lru_cache.
Learning Objectives
By the end of this module…
●
●
●
●
Students recognize and can explain what makes a particular function recursive, and why such recursive
functions are the natural choice for solving computational problems that exhibit self-similarity.
They know why deep linear recursions are no good in practice, and know the rule that every such linear
recursion should have been written as iteration to begin with.
They can recognize a branching recursion that suffers under the exponential burden of needlessly repeated
subproblems, and can decorate their recursion with lru_cache to make the function remember the
subproblems that it has solved so far, so that the next time around their results can be simply looked up
instead of fully recomputed all the way down from scratch.
They have seen enough examples of branching recursions for interesting computational problems to
appreciate the qualitative difference between recursion and iteration in practical use.
Readings
Required Readings
●
"Python Lecture Notes", sections "8.1. Recursive functions for self-similar problems", "8.2. Practical
application of recursion", "8.3. Downsides of recursion", "8.4. Applying functions to other functions", and
"8.5. Defining small functions as lambdas". (Advanced students looking for additional knowledge outside
the course can also check out the sections "8.6. Dynamic evaluation of text as code" and "8.7. Functional
programming tools".)
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 20
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Recommended Readings
●
●
GitHub repository ikokkari/PythonExamples: recursion.py functional.py
YouTube playlist "CCPS 109 Computer Science I, Python" videos: "Python 8-1: A self of selves", "Python
8-2: Remember to remember", "Python 8-3: If you can't beat them, join them", "Python 8-4: Until time
itself runs out", "Python 8-5: Twisty little passages", "Python 8-6: Paint every corner"
Assignments
Some problems in the 109 lab problems collection that benefit from the use of recursion are the following. There
are also several more, although all of them have been all placed in the second half of the collection.
1. Lattice paths (lattice_paths)
2. Split within perimeter limit (perimeter_limit_split)
3. Sum of distinct cubes (sum_of_distinct_cubes)
Tests/Exams
N/A
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 21
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Week 9
Module 9
String processing
Topics
●
●
●
●
●
Applying the ability to slice and dice string objects and put these pieces together into words from a very
large list of words, to find all the words that have some curious property from recreational linguistics.
Using binary search to speed up the search for words that start or end with the given prefix.
Using simple regular expressions to look for patterns inside words.
Using recursion to generate all possible strings that match the given rule.
Combining recursion and lazy sequences to systematically visit all possible solutions to the given recursive
problem, instead of returning merely the first or the best such solution.
Learning Objectives
By the end of this module…
●
●
●
●
After all the multitude of examples from this module, students are confident in their abilities to operate on
character sequences.
Students understand the idea of the binary search algorithm central in many computations, and can explain
why binary search is a good algorithm to use when they know the data to be sorted.
They know that regular expressions exist as a universal text pattern matching mechanism and which Python
module contains functions to harness this power.
They can use the branching possibilities of recursion to extend the existing string prefix into all possible
continuations within the given constraints.
Readings
Required Readings
Nothing required this week.
Recommended Readings
●
●
GitHub repository ikokkari/PythonExamples: wordproblems.py morse.py wordfill.py
YouTube playlist "CCPS 109 Computer Science I, Python" videos: "Python 9-1: Trie as you may", "Python
9-2: A multitude of words", "Python 9-3: Steamy computations", "Python 9-4: It means what I choose it to
mean".
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 22
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Assignments
In the spirit of the topic of this module, the lab problems from "109 Python Problems for CCPS 109" for this week
deal with text strings and collections of strings.
1. Detab (detab)
2. Expand positive integer intervals (expand_positive_intervals)
3. Possible words in Hangman (possible_words)
Tests/Exams
N/A
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 23
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Week 10
Module 10
Numerical computation with numpy
Topics
●
●
●
●
●
Using the sys module for introspection to find out things about the current state of computation in Python.
The idea of flexible representations of data whose exact nature we cannot predict, versus inflexible but
more compact representations for data of known fixed nature.
Creation and manipulation of low-level numpy arrays of arbitrary dimensions of uniform elements of data.
Mathematical operations on numpy arrays.
Image processing with numpy, with the acceptance of such images as actually being matrices of small
numbers under all that colourful presentation.
Learning Objectives
By the end of this module…
●
●
●
Students can read through simple numpy examples without any fancy operations involved in them and
explain, often after quickly consulting the numpy documentation that they now know to keep open in
another browser tab, what each statement does and why it is there.
Aided with the documentation, they can create simple numpy vectors and arrays and perform basic
mathematical calculations on them at whichever level they are in their mathematical knowledge outside this
course.
They can appreciate the power of numpy in its ability to perform image processing, and that a pixel image
is just a matrix of numbers that encode the colours.
Readings
Required Readings
●
"Python Lecture Notes", sections "10.1. The numpy array data type", "10.2. Operations over numpy arrays",
"10.3. Processing pixel images as numpy arrays".
Recommended Readings
●
GitHub repository ikokkari/PythonExamples: sysandos.py numpydemo.py imagedemo.py
(students who need to learn more numpy for their work and otherwise can check out more advanced
examples fractals.py matplotdemo.py scipywords.py that showcase the capabilities on numpy,
scipy and matplotlib)
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 24
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Assignments
Since the collection "109 Python Problems for CCPS 109" was designed so that each problem could be solved with
only the core Python language and recursion for those problems that gain from it, it contains no problems that would
make the function deal with numpy arrays and their operations. Instead, the following three problems have been
chosen for their instructive and educational value, and have at least some numerical flair in them in that they could
be used as examples in the previous activity.
1. Running median of three (median_of_three)
2. Calling all units, B-and-E in progress (is_perfect_power)
3. Reverse every ascending sublist (reverse_ascending)
Tests/Exams
N/A
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 25
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Week 11
Module 11
Classes and objects in Python
Topics
●
●
●
●
●
Thinking in higher-level abstractions about concepts, instead of their low-level representations inside our
language.
Defining classes in Python. Methods and data inside classes and objects.
Constructors and other magic methods that turn the class into a truly naturalized citizen of the language.
Dynamically adding and modifying properties in classes and objects with the "monkey patching"
mechanism.
Extending existing higher-level types into more specialized subtypes.
Learning Objectives
By the end of this module…
●
●
●
●
Students can be given a simple toy model concept in the style of "bank account" or "animal", and they could
list some methods that would be verbs associated with the concept in the problem domain.
They are able to write that concept as a Python class with the appropriate methods __init__ and __str__,
along with the methods that correspond to those chosen verbs.
They would know how to look up which magic method corresponds to the language operator that they
would like to work with that data type, and implement that magic method in that class.
They can explain the dynamic nature of Python as names existing inside the objects, and how this reality
naturally allows some methods to be "monkey patched" to behave differently just for one object as they do
for other instances of that class.
Readings
Required Readings
●
"Python Lecture Notes", sections "11.1: Thinking in abstractions instead of implementations", "11.2.
Defining your own classes", "11.3. Naturalized citizens of Pythonia", "11.4. Patching in new properties",
"11.5. Subtyping existing concepts", "11.6. Multiple inheritance"
Recommended Readings
1. GitHub repository ikokkari/PythonExamples: cards.py temperature.py shape.py
2. YouTube playlist "CCPS 109 Computer Science I, Python" videos: "Python 11-1: Brothers from the same
mold"
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 26
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Assignments
Again, since the problem collection "109 Python Problems for CCPS 109" was designed so that each problem could
be solved using only the core Python language (with a sprinkle of recursion but only for those problems that actually
ain from it), it contains no problems where you would have to define your own data types for complex concepts.
Instead, the last three problems chosen for their educational value continue on the theme of text strings.
1. Longest palindrome substring (longest_palindrome)
2. Brangelina (brangelina)
3. Autocorrect for stubby fingers (autocorrect_word)
Tests/Exams
N/A
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 27
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Week 12
Module 12
Review and spillover
Topics
●
Example programs and individual functions that were skipped during the previous modules.
●
Some minor language details and gotchas related to the previous functions.
●
Review of what the examples left for this module teach us about the important themes and
techniques from the previous modules.
Learning Objectives
By the end of this module…
●
Students have a more complete understanding of the topics of the course.
●
They feel confident in finishing up their graded lab problems.
Readings
Required Readings
N/A
Recommended Readings
N/A
Assignments
N/A
Tests/Exams
N/A
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 28
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Week 13
This week is not really a full week. It is one day only (Saturday). The date generated in the course
outline will represent the last official day of the course. It should be reserved for the Final Exam or
Final Project. All on-campus exams are scheduled for Saturday of this week, and all online exams
should be completed by end of day.
Module 13
Submission of graded labs
Assignments
N/A
Tests/Exams
Students submit the file labs109.py that collects and contains all functions from the graded labs that
they have successfully solved during this course, in the sense that the automated tester script
test109.py accepts that function as being correct. The grading instructor can execute the tester script
with the student submission file and compute the course grade based on the number of lab problems
that the student has correctly solved.
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 29
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Course Textbook(s) and Materials
Required Textbook(s)
This course doesn’t use any textbooks. All lecture notes and example programs are available for free
download in the public GitHub repository at https://github.com/ikokkari/PythonExamples. The graded
lab problems and the automated test environment are available in another public GitHub repository
https://github.com/ikokkari/PythonProblems.
Recommended Readings or Resources
In addition to the notes and examples created by the instructors, students will find their work and
learning easier if they keep the Python Library Reference in another browser tab to consult the details
of the standard library functions instead of memorizing those.
Assessment and Evaluation
Marking Scheme
Assessment
Graded labs
Total
Course Weight
(in %)
100
Week Assigned
Week Due
5
13
100%
Please do not modify, standard wording for all courses:
●
For more information about exams, please see Ryerson University’s Senate Policy on
Examinations No. 135.
●
For more information about grade appeals and reassessments, please see Ryerson
University’s Senate Policy on Undergraduate Academic Consideration and Appeals no. 134.
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 30
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Assignment Descriptions
Over the years of teaching the past classroom versions of this course, the instructors have compiled a
collection “109 Python Problems for CCPS 109” that students can freely choose the problems they
wish to solve. Some of these problems are assigned to be practiced during some particular module that
they fit nicely, but once the students have learned the core Python language to the sufficient extent,
they can begin solving the additional lab problems of their choice on their own time. Each additional
problem further drills in the language syntax and sharpens the techniques of putting these language
structures together to achieve greater things.
The successful completion of any ten lab problems gives the student the lowest passing grade of 50%.
From this baseline, every additional successfully solved lab problem then adds 1% to the total grade.
To earn the highest possible letter grade of A+ that corresponds to the numerical grade of 90%, a
student would therefore need to complete any fifty lab problems of their choosing.
Since this automated tester for the graded labs is freely available for students both locally and on the
cloud, students are at all times fully aware of their current standing with respect to the course marks,
and of how many more lab problems they would have to successfully solve during the rest of the course
relative to their grade goal.
Participation Details
You are encouraged to provide additional guidelines for participation. You may choose to use
evaluation criteria or rubrics that outline the quality and length of the posts as well as the required
number of posts per week, or the days when posts are due each week.
The paragraph below is the standard language that appears on the page by default.
The online discussion board is an excellent way to enhance your learning and practice critical thinking.
Discussing content in an online environment allows you to reflect before contributing and take time to
consider other student postings. By providing opportunities for networking and community building, the
discussion board can reduce the feeling of isolation that sometimes occurs in online courses.
The instructors will also regularly manage the discussion board and clarify issues that come up there.
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 31
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Etiquette Guidelines
●
●
●
●
●
●
●
●
Treat online forums as academic, public-speaking spaces. Post comments in the same way you
would speak in a traditional classroom—politely and respectfully. Forums are a place for
discussion and debate about the content you are studying. They are a way of getting to know
and interact with your peers and instructor(s) and share your views and ideas
Respect diversity. There will be multiple perspectives and experiences shared relating to course
content and subject matter practice. You may disagree with someone’s perspective or have a
different one, but positioning any perspective as “right” or “wrong” should be avoided.
The instructor is the course expert and will address any incorrect information in forums with
guidance and support as needed.
Read and respond to peer postings. If someone comments on your thread or asks a question,
monitor and reply.
Keep criticism constructive and positive. Reference course readings and content to make
suggestions or recommendations.
In online discussions, students are expected to comply with Ryerson University’s Senate Policy
on the Student Code of Non-Academic Conduct No. 61. Inappropriate forum behaviour should
be reported to the instructor immediately. Allow the instructor time to respond and take action.
Do not engage an inappropriate peer directly.
Be concise. You, your instructor, and your peers have many posts to read each week. Unless
your instructor states otherwise, keep your initial postings and responses brief and meaningful
(one to two short paragraphs).
Your instructor may provide a separate course Q & A forum. This is the ideal place to post
general questions about assignments and schedules and to seek clarification on forum issues.
Questions or items that are personal in nature, should be communicated with your instructor
outside of this forum.
Late Assignments, Missed Term Work or Examinations and Course
Repeats
As per Senate Policy, please specify expectations regarding deadlines and penalties for missed and
late submissions.
Late Assignments
All assignments are due at once at the end of the course. The deadline cannot be more lax than this,
and therefore late assignments after this ultimate deadline are rejected unless accompanied by
verifiable documented reason for missing the work.
Please do not modify, standard wording for all courses:
Missed Term Work or Examinations
Students are expected to complete all assignments, tests, and exams within the time frames and by
the dates indicated in this outline. Exemption or deferral of an assignment, term test, or final
examination is only permitted for a medical or personal emergency or religious observance.
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 32
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Health Certificates
If you will miss an assignment, test or examination due to illness, you must submit a health certificate
and an Academic Consideration Request form within three working days of the missed deadline, test,
or examination.
If you are a full-time or part-time degree student, then you submit your medical documentation to
your own program school/department. If you are a certificate or non-certificate student, then
submit your documentation to the staff at the Chang School. Your continuing education contract
lecturer can no longer accept your documentation. If you have questions, please contact The Chang
School.
For more information, please consult Ryerson University’s Senate Policy on Undergraduate
Academic Consideration and Appeals no. 134.
Religious, Aboriginal, and Spiritual Observance
For accommodations based on medical or religious, Aboriginal, and spiritual observance reasons, a
Request for Accommodation of Student Religious, Aboriginal and Spiritual Observance form and an
Academic Consideration Request form must be submitted within the first two weeks of class or, for a
final examination, within two weeks of the posting of the examination schedule.
Official forms may be downloaded from the Ryerson Forms and Guidelines website or picked up from
The Chang School at Heaslip House, 297 Victoria Street, Main Floor.
For more information, please consult Ryerson University’s Senate Policy on Accommodation of
Student Religious, Aboriginal and Spiritual Observance No. 150.
Course Repeats
Senate GPA Policy prevents students from taking a course more than three times. For the complete
GPA Policy, see Ryerson University’s Senate Policy on Undergraduate Grading, Promotion, and
Academic Standing Policy No. 46.
Plagiarism
Please do not modify, standard wording for all courses:
The Ryerson Student Code of Academic Conduct defines plagiarism and the sanctions against
students who plagiarize. All students are strongly encouraged to go to the Ryerson Academic
Integrity Office website and complete the tutorial on plagiarism.
For more information, please consult Ryerson University’s Senate Policy on Academic Integrity No.
60.
For the Use of the Plagiarism-Detection Service section below, the University has subscribed
to Turnitin, a service that helps instructors identify Internet plagiarism and helps students
maintain academic integrity.
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 33
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
If you use Turnitin in your course, you must include this section and choose one of the
statements provided below (delete the one that is not relevant).
The work submitted by students in this course will be submitted to Turnitin. Students who do not want
their work submitted to this plagiarism-detection service must consult with the instructor to make
alternate arrangements by the end of the second module.
Other Course Information
Please do not modify, standard wording for all courses:
To learn more about course management expectations, please review Ryerson University’s Senate
Policy on Course Management No.166.
Accessibility
Per Ryerson University’s Senate Policy for Academic Accommodation of Students with Disabilities No.
159, the University will provide academic accommodations for students with disabilities in accordance
with the Ontario Human Rights Code and the Accessibility for Ontarians with Disabilities Act.
If such accommodation is required, please contact Student Learning Support, preferably before the
start of the course to allow for time to make any necessary arrangements.
Ryerson Student Email
Please do not modify, standard wording for all courses:
All students in full and part-time graduate and undergraduate degree programs and all continuing
education students are required to activate and maintain their Ryerson online identity at
ryerson.ca/accounts in order to regularly access Ryerson’s email, RAMSS, the my.ryerson.ca portal
and learning management system, and other systems by which they will receive official university
communications.
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 34
Course Title
Course Code
CECL
Email
Computer Science I
CCPS 109
Dr. Muhammad Naeem Irfan
naeem@ryerson.ca
Student Support
Please do not modify, standard wording for all courses:
If you are experiencing technical or administrative issues with your course, help is available from
Student Support for Distance Courses via email at distance@ryerson.ca or by phone from Monday to
Friday, 9 a.m.-5 p.m., at (416) 979-5315.
Course Outline
Last updated: August 29, 2019
Created by Digital Education Strategies at The G. Raymond Chang School of Continuing Education.
This Course Outline Template is licensed under a Creative Commons Attribution 4.0 license.
Page 35
Download