Python for Computing Syllabus
Intensive Short Course with Elements of Computing
This course provides an introduction to Python. You will learn enough of the Python language to write your own programs, use Python libraries, and manage data files.
What You Will Learn
Python is the most widely used language for data analysis and visualization. It owes its remarkable success to the large and dedicated Python community. This community actively supports both beginning and advanced programmers via various discussion forums such as Stack Overflow, and has developed over 100,000 libraries. The quality of these free libraries is comparable to the quality of expensive commercial computing products such as SAS or Matlab. In this course you will be introduced to the Fractions, Time, Numpy, Scipy, and Matplotlib libraries, but there are many more.
In contrast to most other languages, Python can be used by non-programmers as a powerful command-line scientific calculator. That’s where this course begins, and it progresses through variables, text string operations, functions, tuples, lists, sets, the for loop, Boolean logic, conditional statements and expressions, the while loop, file operations, and working with dictionaries.
Recommended Background
Given that most applications of Python are in Data Science, Machine Learning and related areas, this course includes elements of computing. However, it focuses on the programming side of things rather than on math. The knowledge of high school math is sufficient. Most calculations are done using functions from imported Python libraries.
Having prior coding experience with any language, including educational programming languages, is helpful. Should you find this course too challenging, NCLab provides a more relaxed, slower-paced Introduction to Programming course as a starting course.
Course Structure and Length
This course is self-paced, and you will practice each skill and concept as you go. Automatic feedback is built into the course for both practices and quizzes.
The course is divided into two Units, and each Unit is composed of five Sections. Each Section consists of 7 instructional/practice levels, a quiz, and a master (proficiency) level. You can return to any level or quiz for review.
While learning skills in this Python course, you can practice writing code, work with libraries and create portfolio artifacts with NCLab’s Python app. Use a project idea from NCLab or create your own.
Python for Computing is designed to take approximately 40 to 60 hours. Since the course is self-paced, the amount of time required to complete the course will vary from student to student. You are responsible for learning both the tutorial content and the skills acquired through practice
Unit 1: Calculations, Libraries, Variables, Functions, Tuples, Lists, Indices, For-Loop
Section 1
- Use Python as a powerful command-line scientific calculator.
- Add, subtract, multiply and divide numbers.
- Compute using the priorities of arithmetic operators and parentheses.
- Understand how, In contrast to other languages, the integer division in Python 3 yields the correct real value.
- Modern and traditional ways of importing libraries.
- Import the fractions library and work with fractions.
- Use the built-in function help.
- Import Numpy and use its functionality.
Section 2
- Use the floor division operator //, modulo operator %, and power operator **.
- Understand that real numbers are not represented exactly in the computer, which can lead to problems with the floor division and modulo operators.
- Real numbers should never be compared using the standard comparison operator ==, and how to compare them correctly using a small tolerance.
- Compute and convert data sizes, including b, KB, MB and GB.
Section 3
- Learn how to create text strings, and basic text string operations.
- Use quotation marks correctly when defining text strings.
- Define text string variables from raw text strings.
- Clean text strings of trailing spaces and inspect hidden characters using the function repr.
- Add text strings, multiply them with integers and update them with the operators += and *=.
- Use the operators +=, -=, *= and /= for numerical variables.
- Measure the length of text strings with the function len.
- Use the special newline character \n.
- Define functions and call them from the main program.
- Write docstrings and comment code.
- Understand that functions do not have to accept arguments and do not have to return values.
- Use functions that accept multiple arguments and return multiple values.
Section 4
- Understand the difference between global and local scopes, and global and local variables.
- Use the terms function parameters and function arguments correctly.
- Understand that a function which returns multiple values actually returns a tuple.
- Unpack a tuple, and access individual items using indices.
- Understand how indices are numbered.
- Use the for loop to parse tuples and text strings one item / character at a time.
- Understand that in Python, loops do not create their own scope.
- Use the command pass as a placeholder to do nothing.
- Apply similar functions and methods to text strings and tuples, such as using indices and measuring their length with the function len.
- Understand that Python is an object-oriented language where objects have methods.
- Apply text string methods to text strings, such as upper and lower.
- Use the forloop in combination with the range function; use the range function in three different ways.
Section 5
- Create empty and non-empty lists.
- Add lists and multiply them with numbers.
- Add items to lists using the list methods append and insert.
- Parse lists using the for loop and use indices.
- Remove and return list items with the method pop.
- Remove and destroy list items using the command del.
- Reverse lists with the function reversed and list method reverse.
- Sort lists with the function sorted and list method sort.
- Insert numbers and other values into text strings.
- Understand the properties of mutable and immutable objects: that lists, sets and dictionaries are mutable objects while numbers, text strings, booleans and tuples are not.
Unit 2: Logic, Decision-Making, File Operations, and Dictionaries
Section 6
- Use conditions and decision making in programs.
- Work with Boolean values, operators, expressions and functions.
- Write conditions using if, if-else and if-elif-else statements.
- Search for items in tuples and lists, and for substrings in text strings.
- Remove duplicates from tuples and lists.
- Chain algebraic comparison operators.
- Instantly terminate any loop with the break statement.
- Calculate probabilities with Scipy using built-in Probability Density Functions (PDFs) and Cumulative Distribution Functions (CDFs). Math is provided.
Section 7
- Write programs using the while loop; compare its properties to the for loop.
- Understand the main applications for the while loop.
- Understand that the keyword while can be used to create infinite loops, and when these are useful.
- Use different ways to check if a list is non-empty.
- Implement the interval bisection method in Python.
- Define and use anonymous lambda functions.
- Implement Newton’s method in Python (math is provided).
- Implement the Steepest Descent Method (SDM) in Python (math is provided).
- Solve a real-world optimization problem using the SDM method.
Section 8
- Explore the concept of mutable and immutable data types in-depth.
- Use functions with default parameters.
- Check variable type at runtime.
- Raise an exception when a program is used incorrectly.
- Work with complex numbers.
- Slice text strings, tuples and lists, and create their copies and reversed copies.
- Time programs, and work with system date and time.
- Use ternary expressions and list comprehension.
Section 9
- Open and close files for reading and writing.
- Parse a text file line-by-line using the for loop.
- Clean text strings with strip, lstrip and rstrip.
- Split text strings into words.
- Count lines, words and characters in a text file.
- Rewind a file to manage multiple operations.
- Read selected lines and use the file method readline.
Section 10
- Create and work with Python dictionaries.
- Understand that Python dictionary is the same thing as SQL table.
- Create empty and non-empty dictionaries.
- Add and remove key:value pairs.
- Access values using keys.
- Parse dictionaries using the for loop.
- Extract lists of keys, values, and items from dictionaries.
- Zip lists of keys and values to create a dictionary.
- Combine dictionaries.
- Access the Google translate API from Python programs for real-time translations.