This course is an introductory course in programming and
problem-solving at the first-year level. It is assumed that
students will have some ability to think logically and apply that
skill to the design and development of simple computer programs.
Currently this course uses Python as the programming language, and
may include (depending on time available) some discussion of one or
more Python modules that science students and others who have to deal
with various forms and quantities of data should find useful.
The course requires weekly assignments that involve completing
activities of three different types in the zyBook used as the
online text for the course: Participation Activities, Challenge
Activities and Lab Activities. There will also be Breakout Room Exercises that may or may not contribute to the overall grade (see the Grading Scheme) and there will also be a final exam. Each week there are two 75-minute lectures, each followed by a 75-minute lab.
Summary of Topics To Be Covered (subject to time limitations)
The following is a list of sections from the zyBook for this
course. We will proceed through the zyBook in a linear fashion,
unless there is announcement to the contrary at one or more points
along the way, and covering as much of the material as time permits.
Some of the zyBook material listed below may be omitted, and there may
be some additional material covered that does not appear in the zyBook,
in which case appropriate external references will be given.
- Introduction to Python 3 [programming (general), programming
using Python, basic input and output, errors, development environment,
computers and programs (general), computer tour, language history]
- Variables and Expressions [variables and assignments, identifiers,
objects, numeric types: floating-point, arithmetic expressions,
Python expressions, division and modulo, module basics, match module,
representing text]
- Types [string basics, list basics, set basics, dictionary basics,
common data types summary, type conversions, string formatting,
binary numbers]
- Branching [if-else branches (general), if-else statement, more
if-else, equality and relational operators, boolean operators and
expressions, membership and identity operators, order of evaluation,
code blocks and indentation, conditional expressions]
- Loops [loops (general), while loops, more while loops, counting,
for-loops, counting while using the range() function, while vs. for
loops, nested loops, developing programs incrementally, break and
continue, loop else, getting both index and value when looping:
enumerate()]
- Functions [user-defined function basics, function parameters,
returning values from functions, dynamic typing, reasons for defining
functions, function stubs, functions with branches/loops, functions
are objects, functions: common errors, scope of variables and functions,
namespaces and scope resolution, function arguments, keyword arguments
and default parameter values, arbitrary argument lists, multiple
function outputs, using docstrings to document functions and viewing with help,
engineering examples]
- Strings [string slicing, advanced string formatting, string
methods, splitting and joining strings]
- Lists and Dictionaries [lists, list methods, iterating over a list,
list games, list nesting, list slicing, loops modifying lists, list
comprehensions, sorting lists, command-line arguments, additional
practice: engineering examples, dictionaries, dictionary methods,
iterating over a dictionary, dictionary nesting, string formatting
(old), string formatting using dictionaries]
- Classes [classes: introduction, classes: grouping data, instance
methods, class and instance object types, class example: seat
reservation system, class constructors, class interfaces, class
customization, more operator overloading: classes as numeric types,
memory allocation and garbage collection]
- Exceptions [handling exceptions using try and except, multiple
exception handlers, raising exceptions, exceptions with functions,
using finally to cleanup, custom exception types]
- Modules [modules, finding modules, importing specific names from
a module, executing modules as scripts, reloading modules, packages,
standard library]
- Files [reading files, writing files, interacting with file
systems, binary data, command-line arguments and files, the 'with'
statement, comma separated values files]
- Inheritance [derived classes, accessing base class attributes,
overriding class methods, is-a versus has-a relationships, mixin
classes and multiple inheritance, testing your code: the unittest
module]
- Recursion [recursive functions, recursive algorithm: Search,
adding output statements for debugging, creating a recursive function,
recursive math functions, recursive exploration of all possibilities]
- Plotting [introduction to plotting and visualizing data, styling
plots, text and annotations, numpy, multiple plots]
- Searching and Sorting Algorithms [searching and algorithms, binary
search, O notation, algorithm analysis, sorting: introduction,
selection sort, insertion sort, quicksort, merge sort]
- Additional Material [zyBooks built-in program window]