CSC 221: Introduction to Programming
- To develop problem solving and programming skills to enable the student to design solutions to non-trivial problems and implement those solutions in Python.
- To master the fundamental programming constructs of Python, including variables, expressions, functions, control structures, and lists.
- To build a foundation for more advanced programming techniques, including object-oriented design and the use of standard data structures (as taught in CSC 222).
overview & history: hardware vs. software, technology generations, ...
problem-solving skills, critical thinking skills, communiation skills
simple, visual introduction to programming concepts
actions (e.g., move), conditionals, loops, event-handlers, variables
simple object interaction via sensing and broadcasts
introduction to object-oriented concepts
sprites = objects, sprite properties = fields, script blocks = methods
PYTHON LANGUAGE FEATURES
basic data types: numbers, strings, Booleans
naming conventions, assignment statements, expressions
def, parameters, return statements, doc strings
built-in functions (print, abs, max, min), importing modules (random, math)
if statement, Boolean operators (<, <=, >, >=, ==, !=, and or, not)
if (1-way), if-else (2-way), cascading if-else, elif (multi-way)
for loops, counter/range-driven
while loops, condition-driven
common operations/functions: +, *, len, indexing, slicing
traversal: by item, by index
strings (sequences of characters, immutable)
methods: isalpha, capitalize, upper, strip, find, replace, ...
examples: palindrome, Caesar cipher, Pig Latin
lists (sequences of arbitrary items, mutable)
methods: count, index, sort, append, extend, insert, remove, ...
examples: list of words, row of cards, 2-D grid of pixels
class definition, fields, methods, self
special methods: __init__, __str__
examples: Die, DeckOfCards, RowOfCards, Image
conditionals for alternatives
e.g., recognize doubles, recognize a vowel, distinguish Skip-3 commands
loops for repetition (conditional while loops, range-driven for loops)
counters & sums for collecting data
e.g., roll dice until doubles, count number of vowels, play until "quit"
String traversal/concatenation for manipulating text
e.g., construct acronym, encode a message, get avg word length
input for user input; read/readline/write for files
e.g., interactive Skip-3, reading text from a file & splitting into words
lists for storing and accessing arbitrary data
e.g., words from a line of text, cards in a deck, pixels in an image
classes model real-world entities; objects are instances of those classes
fields maintain state of an object; methods implement behaviors
e.g., RowOfCards models a row of cards
field (list of cards), methods (addAtEnd, moveCard, numCards, ...)
1. Programming concepts (in Scratch)
2. Python statements & modules (wins & time & monograms)
3. Functions (rewriting HW2 & random sequences)
4. Loops & simulations (ping pong)
5. Strings & text files (readability)
6. Lists & data (CodingBat & hashtags)
7. Classes and OOP (Skip-3)