# CS 20: Introduction to Creative Computing

 Search Site:

After studying this chapter, a student should be able to:

• describe what an algorithm is
• provide examples of algorithms
• distinguish between actions and control statements in algorithms
• identify appropriate algorithms for humans versus computers
• distinguish between problems and algorithms
• define abstraction, refinement, and encapsulations
• write algorithms at different levels of abstraction
• describe how input and output relate to encapsulation
• employ encapsulation to breakdown algorithms written in pseudocode

Assignment: Creating Pseudocode

1.7 Abstraction

1.8 Refinement

Assignment: Refining Pseudocode

1.9 Encapsulation

Encapsulating Pseudocode

1.10 Input and Output

Assignment: Determine the Inputs and Outputs

Discussion: Inputs and Outputs

1.11 Why Abstraction is Important

Key Terms

Comprehension Questions

After studying this chapter, a student should be able to:

• distinguish between a programming language and a development environment
• describe the visual coordinate system used in Processing
• create Processing programs with simple visual output such as lines and shapes

2.1 The Python Language

2.2 The Processing Environment

2.3 Drawing in Processing

2.3.1 The Processing Coordinate System

2.3.2 Other Basic Shapes

Practice 2.1

2.3.3 Text Output

Practice 2.2

2.3.4 Processing Versus Python

Assignment: Draw Something, Anything!

Key Terms

Comprehension Questions

After studying this chapter, a student should be able to:

• describe what a function is
• describe how to call a function
• explain what the arguments of a function are
• compose functions in Python that perform a subtask
• compose functions in Python that accept arguments as input
• describe the role of a function’s parameters
• distinguish between arguments and parameters
• author appropriately descriptive comments to document a function

Chapter 3: Functions Introduction

3.1 Functions and Abstraction

3.2 Calling Functions

3.3 Creating Functions

3.3.1 Defining Functions: The def Statement

3.3.2 Functions that Perform Simple Subtasks

3.3.3 Defining Before Calling Functions

3.3.4 Comments in Python

3.3.5 Documenting Function Headers

Practice 3.1

3.3.6 Functions That Accept Arguments

3.3.7 Arguments Versus Parameters

3.3.8 Designing Programs with Functions

Key Terms

Comprehension Questions

Assignment: Functions for Clarity

After studying this chapter, a student should be able to:

• describe the grayscale colour model
• describe the RGB colour model
• author Processing code that uses colour

Chapter 4: Colour in Processing Introduction

4.1 Grayscale Colour

4.2 Colour Functions in Processing

4.2.1 Background Colour

4.2.2 Stroke Colour

4.2.3 Fill Colour

4.3 The RGB Colour Model

4.3.1 Using RGB Colours in Processing

Key Terms

Assignment: Using Colour in Processing

After studying this chapter, a student should be able to:

• define the elements of the interaction cycle
• distinguish between interactive and run-to-completion systems
• describe the behaviour of the Processing setup() function
• describe the behaviour of the Processing draw() function
• author basic interactive Processing programs

Chapter 5: Interaction and Events Introduction

5.1 Interactive Systems

5.1.1 The User

5.1.2 The System

5.1.3 User Actions

5.1.4 System Feedback

5.1.5 Interaction Versus Run-to-Completion

5.2 Interaction in Processing

5.2.1 The setup() Function

5.2.2 The draw() Function

Investigation 5.1

Investigation 5.2

Investigation 5.3

Investigation 5.4

5.2.3 Event Handling Functions

Practice 5.1

Practice 5.2

Assignment: Scene Switching

Key Terms

After studying this chapter, a student should be able to:

• distinguish between atomic data and compound data
• describe what a data type is
• describe what a literal value is in Python
• give examples of literal values corresponding to integer, floating-point, and string data
• use the print syntax to display literal values on the console

6.1 Data

6.1.1 Atomic Data

6.1.2 Compound Data

6.1.3 Data Types

6.2 Literals

6.2.1 Strings

6.2.2 Concatenation

Key Terms

Practice Questions

Comprehension Questions

After studying this chapter, a student should be able to:

• describe what a variable is
• explain the naming rules for variables
• describe what an expression is in Python
• list the basic arithmetic operators in Python
• compose valid arithmetic expressions in Python using operators and literals
• compose valid expressions in Python using variables
• use the print syntax to display literal values and the values of variables on the console
• use Processing event handling to save user actions to a variable

7.1 Variables

7.1.1 Variable Names

7.1.2 Variable Assignment

7.1.3 Using Variables to Print

7.1.4 Avoiding Name Errors

7.2 Expressions

7.2.1 Literals as Expressions

7.2.2 Variables as Expressions

7.2.3 Operators

7.2.4 Using Numbers and Operators

7.2.5 Concatenation of Numbers and Strings

7.3 Using Variables in Functions

7.3.1 Handling User Input using Variables

Key Terms

Assignment: Equations in Functions

Assignment: Resizable Image

Comprehension Questions

After studying this chapter, a student should be able to:

• describe how to save user input
• author programs that accept user input in the form of string, integers, or floats
• print out user input as a string

8.1 Input in Python

Practice Question

After studying this chapter, a student should be able to:

• format code according to PEP8
• choose appropraite names for variable, functions, and constants
• use vertical and horizontal whitespace to improve readability
• avoid lines of code that are too long
• indent code using spaces
• use appropriate comments for lines of code and functions

9.0 Python Style Guide: PEP8 Introduction

9.1 Naming Conventions

9.1.1 Naming Styles

9.1.2 How to Choose Names

9.2 Code Layout

9.3 Maximum Line Length and Line Breaking

9.4 Indentation

9.5.3 Document Strings

9.6 Whitespace in Expressions and Statements

9.6.1 Trailing Whitespace

9.7 When to Ignore PEP8

After studying this chapter, a student should be able to:

• describe the role of a function’s return value
• compose functions in Python that perform a subtask and return the result
• explain the role and behaviour of the return statement
• save the result of a function call to a variable
• use functions with return values in expressions
• trace program behaviour in and out of nested function calls

10.1 Functions That Compute Values

10.1.1 The Return Keyword

Practice Questions

10.1.2 Functions with Parameters

Practice Questions

10.1.3 Return Statements Versus System Feedback

10.2.1 More Built-In Python Functions

Practice Questions

10.3 Nested Function Calls

Key Terms

Comprehension Questions

Practice Question

After studying this chapter, a student should be able to:

• identify and define the behavious of relationals operators, logical operators, and Boolean expressions in Python
• identify and author correct Python language syntax for branching statements: if, if-else, if-elif-else, and chained statements
• design and author Python programs that use if, if-else, and chained-if statements

11.0 Conditional Branching

11.1 Conditions

11.1.1 Relational Operators

11.1.2 Logical Operators

Practice Questions

11.2 Branching and Conditional Statements

Key Terms

Comprehension Questions

Assignment: Changing Image

After studying this chapter, a student should be able to:

• identify and correctly author Python language syntax for repetition: while-loops and for-loops
• trace by hand the flow of program execution for programs that use while-loops and for-loops
• design and author Python programs that use one or more loops
• describe what an infinite loop is

Investigation: Repetition in Processing

12.0 Repetition Introduction

12.1 Repetition in Processing

12.2 While-Loops

12.2.1 While-Loops for Counting

12.3 For-Loops

12.3.1 Sequences

12.3.2 Ranges and Counting For-Loops

12.4 Choosing the Right Kind of Loop

12.5 Infinite Loops

Comprehension Questions

Exercise 12.1

Exercise 12.2

Exercise 12.3

Exercise 12.4

Exercise 12.5

Exercise 12.6

After studying this chapter, a student should be able to:

• trace behaviour for programs using nested if-statements
• trace behaviour for programs using nested loops
• trace behaviour for programs using nested loops and if-statements combined
• author Python code using nested if-statements, loops, and combinations thereof

13.0 Nesting Programming Constructs

13.1 Nesting If-Statements

13.2 Nesting Loops

13.3 Nesting If-Statements and Loops

13.4 Multiple Layers of Nesting

13.5 Example of Nesting in Processing

Key Terms

Comprehension Question

Assignment: Repeating Pattern

After studying this chapter, a student should be able to:

• identify a list, tuple, and dictionary in code
• print lists, tuples, and dictionaries
• print items from lists, tuples, and dictionaries
• change, add, and delete values in a dictionary

14.0 Compound Data Review

14.1 Examples of Dictionaries in Python

14.2 Examples of Lists in Python

14.3 Examples of Tuples in Python

14.4 Printing Lists and List Items

Practice Questions

14.5 Printing Tuples and Tuple Items

14.6 Printing Dictionaries and Dictionary Items

Practice Questions

14.7 Changing, Adding and Removing Elements from a Dictionary

Practice Questions

Key Terms

After studying this chapter, a student will:

• explore the underlying technology of computing devices and the internet, and their impacts on society.
• investigate the impacts of information technologies on privacy, including digital security practices.

15.1 How Computers Work

15.2 How AI Works

15.3 How the Internet Works

15.4 Internet Privacy

15.5 Machine Learning

After studying this chapter, a student will:

• Explore computer science related career paths in Saskatchewan, Canada and the world.

Assignment: Careers in Computer Science Poster

Students will develop a coding project and/or research a topic related to computer science of the student's choice

Final Project Overview

Research Project

Coding Project

Learn a New Programming Language

Web Page Design

Advanced Web Page Design

## Credits

Eramian M, Chan B, Long J, Horsch M. Introduction to Creative Computing. 1st ed. Saskatoon, SK: University of Saskatchewan: Department of Computer Science, 2016.

Finer, Jasmine. “How to Write Beautiful Python Code With PEP 8.” Real Python, Real Python, 7 Nov. 2020, realpython.com/python-pep8/.

Matthes, Eric. Python Crash Course. 2nd ed. No Starch Press, May 2019.

“Python IF, ELSE, ELIF, Nested IF & Switch Case Statement.” Meet Guru99 - Free Training Tutorials & Video for IT Courses, www.guru99.com/if-loop-python-conditionalstructures.html.