Python Programming I

A first course in programming with Python: values, variables, decisions, loops, functions, lists, dictionaries and files.

PYTH-101 Year 1 3 credits 12 lessons · 5 h 7 min ▶ Video lessons coming soon

Offered by HSM University · IT Foundations

This is the American version of this course. See the Canadian version.

What you'll learn

  • Explain what a program is, how the Python interpreter runs code, and how to write, save and run a script.
  • Use Python values of the basic types, store them in well-named variables and convert between types.
  • Write arithmetic, comparison and logical expressions, applying operator precedence correctly.
  • Clean, slice, search and format text with string methods and f-strings.
  • Make decisions with if, elif, else and match, and choose test values that cover every branch and boundary.
  • Repeat work with while and for loops, using counters, running totals, sentinels, break and continue.
  • Define and call functions with parameters, default values and return values, and test them with assert.
  • Store and process ordered data with lists and tuples, including sorting, comprehensions and safe copying.
  • Look up, count and group data with dictionaries, and compare groups with sets.
  • Read and write text, CSV and JSON files safely with the with statement.
  • Handle and raise exceptions so that programs respond sensibly to bad input and missing files, and debug logic errors.
  • Design, build, test and review a small menu-driven command-line application that saves its data.

Course content

12 lessons · 5 h 7 min total · final exam

  1. 1 Programs, Python and your first script 34 min · quiz
  2. 2 Values, types and variables 27 min · quiz
  3. 3 Expressions and operators 22 min · quiz
  4. 4 Strings and text 24 min · quiz
  5. 5 Making decisions with if statements 23 min · quiz
  6. 6 Loops: while and for 24 min · quiz
  7. 7 Functions 24 min · quiz
  8. 8 Lists and tuples 24 min · quiz
  9. 9 Dictionaries and sets 23 min · quiz
  10. 10 Reading and writing files 24 min · quiz
  11. 11 Errors and exceptions 26 min · quiz
  12. 12 Capstone: a small command-line application 32 min · quiz
  13. E Final exam 20 questions

Description

A first course in programming with Python: values, variables, decisions, loops, functions, lists, dictionaries and files.

Part of the Information Technology stream, typically taken in year 1.