COMP 1000: Think Like a ComputerΒΆ
Welcome to COMP 1000 (SCI 1002 in Fall 2022 and Winter 2023)!
This is a brand new course designed to introduce people to programming, which is a fundamental skill within Computer Science. At the same time as learning about programming, we will also begin right away by thinking about people: the end users who interact with the software you develop. And when we think about people as end users, we must think about ethics. Thus, this course combines: Programming, Interactivity, and Ethics. PIE!
This course is being taught for the first time at the University of Manitoba in Fall 2022 and for the second time in Winter 2023. It is open to any student and is specifically designed for students who have not taken Grade 12 Computer Science.
Table of ContentsΒΆ
- 1. General Introduction
- 1.1. Foreword to PIE Edition
- 1.2. Introduction: The Way of the Program
- 1.3. Problem Solving, Interactivity & Ethics
- 1.4. The Python Programming Language
- 1.5. More About Programs
- 1.6. Formal and Natural Languages
- 1.7. A Typical First Program
- 1.8. π©βπ» Predict Before You Run!
- 1.9. π©βπ» To Understand a Program, Change It!
- 1.10. Comments
- 1.11. π’ Hello Little Turtles!
- 1.12. π’ Our First Turtle Program
- 1.13. Glossary
- 1.14. Chapter Assessment
- 2. Variables, Statements, and Expressions
- 2.1. Introduction
- 2.2. Values and Data Types
- 2.3. Operators and Operands
- 2.4. Function Calls
- 2.5. Data Types
- 2.6. Type conversion functions
- 2.7. Variables
- 2.8. Variable Names and Keywords
- 2.9. π©βπ» Choosing the Right Variable Name
- 2.10. Statements and Expressions
- 2.11. Order of Operations
- 2.12. Reassignment
- 2.13. Updating Variables
- 2.14. π©βπ» Hard-Coding
- 2.15. Input
- 2.16. Glossary
- 2.17. Exercises
- 2.18. Chapter 2 Assessment
- 3. Debugging and Modules
- 3.1. Introduction to Debugging
- 3.2. π©βπ» Debugging
- 3.3. Syntax errors
- 3.4. Runtime Errors
- 3.5. Semantic Errors
- 3.6. π©βπ» Know Your Error Messages
- 3.7. Introduction to Python Modules
- 3.8. Modules
- 3.9. Ethics & Code Ownership
- 3.10. The
random
module - 3.11. π’ Exploring the Turtle Module
- 3.12. Instances: A Herd of Turtles
- 3.13. Object Oriented Concepts
- 3.14. A Few More
turtle
Methods and Observations - 3.15. π©βπ» Common
turtle
Errors - 3.16. Ethics: Variable Defaults Embed Values
- 3.17. Glossary
- 3.18. Chapter Assessment
- 4. Iteration
- 4.1. Introduction: Iteration
- 4.2. The for Loop
- 4.3. Turtle Repetition
- 4.4. Flow of Execution of the for Loop
- 4.5. Index Operator: Working with the Characters of a String
- 4.6. Strings and
for
loops - 4.7. Lists and
for
loops - 4.8. π©βπ» Naming Variables in For Loops
- 4.9. The Accumulator Pattern
- 4.10. π©βπ» Printing Intermediate Results
- 4.11. Traversal and the
for
Loop: By Index - 4.12. π©βπ» Keeping Track of Your Iterator Variable and Your Iterable
- 4.13. The Power of Iteration
- 4.14. Nested Iteration: Image Processing
- 4.15. Glossary
- 4.16. Exercises
- 4.17. Chapter Assessment
- 5. Functions and Files
- 5.1. Introduction to Functions
- 5.2. Function Definition
- 5.3. Function Invocation
- 5.4. Ethics: Documenting Function Assumptions
- 5.5. Listener Functions
- 5.6. Working with Data Files
- 5.7. Reading a File
- 5.8. Alternative File Reading Methods
- 5.9. Iterating over lines in a file
- 5.10. Finding a File in your Filesystem
- 5.11. Writing Text Files
- 5.12. π©βπ» Tips on Handling Files
- 5.13. Glossary
- 5.14. Exercises
- 5.15. Chapter Assessment
- 6. Conditionals
- 6.1. Intro: What we can do with Turtles and Conditionals
- 6.2. Boolean Values and Boolean Expressions
- 6.3. Logical operators
- 6.4. The
in
andnot in
operators - 6.5. Precedence of Operators
- 6.6. Conditional Execution: Binary Selection
- 6.7. Omitting the
else
Clause: Unary Selection - 6.8. Nested conditionals
- 6.9. Chained conditionals
- 6.10. The Accumulator Pattern with Conditionals
- 6.11. π©βπ» Setting Up Conditionals
- 6.12. Glossary
- 6.13. Exercises
- 6.14. Chapter Assessment
- 7. Integration Pause
- 8. Function Parameters, Return Values and Scope
- 8.1. Introduction: Functions Part II
- 8.2. Function Parameters
- 8.3. Return Values
- 8.4. π©βπ» Decoding a Function
- 8.5. Type Annotations
- 8.6. A function that accumulates
- 8.7. Scope - Local vs Global Variables
- 8.8. Function Composition (functions calling functions)
- 8.9. Flow of Execution Summary
- 8.10. π©βπ» Print vs. return
- 8.11. Side Effects
- 8.12. Listener Functions with Parameters
- 8.13. Glossary
- 8.14. Exercises
- 8.15. Chapter Assessment
- 9. Sequences
- 9.1. Introduction: Sequences
- 9.2. Strings, Lists and Tuples
- 9.3. Immutable Strings
- 9.4. Disambiguating []: creation vs indexing
- 9.5. Length
- 9.6. The Slice Operator
- 9.7. Concatenation and Repetition
- 9.8. Count and Index Methods
- 9.9. Splitting and Joining Strings
- 9.10. Passing Mutable vs Immuatable Objects
- 9.11. Mutable Object Side Effects
- 9.12. Exercises
- 9.13. Chapter Assessment
- 10. Indefinite Iteration
- 11. Event Handling
- 12. Review
- 13. Labs
- 14. Contributor List
- 15. Copyright Notice
You have attempted of activities on this page