Introduction to Python Training
Course Length: 4 days
Delivery Methods:
Available as private class only
Course Overview
In this Python training course, students learn to program in Python. The course is aimed at students new to the language who may or may not have experience with other programming languages.
Course Benefits
- Learn how Python works and what it's good for.
- Understand Python's place in the world of programming languages.
- Learn to work with and manipulate strings in Python.
- Learn to perform math operations with Python.
- Learn to work with Python sequences: lists, arrays, dictionaries, and sets.
- Learn to collect user input and output results.
- Learn flow control processing in Python.
- Learn to write to and read from files using Python.
- Learn to write functions in Python.
- Learn to handle exceptions in Python.
- Learn to work with dates and times in Python.
Course Outline
- Python Basics
- Running Python
- Visual Studio Code
- Python Interpreter in Interactive Mode
- Commercial and Free Python IDEs
- IDLE
- Hello, world!
- Hello World
- Literals
- Python Comments
- Multi-line Comments
- Data Types
- Exploring Types
- Variables
- Variable Names
- Variable Assignment
- Simultaneous Assignment
- A Simple Python Script
- Constants
- Deleting Variables
- Writing a Python Module
- The main() Function
- print() Function
- Named Arguments
- Collecting User Input
- Hello, You!
- Getting Help
- Running Python
- Functions and Modules
- Defining Functions
- Variable Scope
- Global Variables
- Function Parameters
- Using Parameter Names in Function Calls
- A Function with Parameters
- Default Values
- Parameters with Default Values
- Returning Values
- Importing Modules
- Module Search Path
- pyc Files
- Math
- Arithmetic Operators
- Modulus and Floor Division
- Floor and Modulus
- Assignment Operators
- Precedence of Operations
- Built-in Math Functions
- int(x)
- eval(str)
- float(x)
- abs(x)
- min(args) and max(args)
- pow(x,y[,z])
- round(number[, n])
- sum(iter[, start])
- The math Module
- Additional math Functions
- The random Module
- Seeding
- How Many Pizzas Do We Need?
- Arithmetic Operators
- Python Strings
- Quotation Marks and Special Characters
- Escaping Characters
- Triple Quotes
- String Indexing
- Indexing Strings
- Slicing Strings
- Slicing Strings
- Concatenation and Repetition
- Concatenation
- Repetition
- Repetition
- Combining Concatenation and Repetition
- Common String Methods
- String Formatting
- Format Specification
- Long Lines of Code
- Playing with Formatting
- Formatted String Literals (f-strings)
- Getting Acquainted with f-strings
- Built-in String Functions
- str(object)
- len(string)
- min() and max()
- Outputting Tab-delimited Text
- Quotation Marks and Special Characters
- Iterables: Sequences, Dictionaries, and Sets
- Definitions
- Sequences
- Lists
- Deleting List Elements
- Sequences and Random
- Remove and Return Random Element
- Tuples
- The Immutability of Tuples
- Lists vs. Tuples
- Ranges
- Converting Sequences to Lists
- Indexing and Slicing
- Simple Rock, Paper, Scissors Game
- Slicing Sequences
- min(iter) and max(iter)
- sum(iter[, start])
- Converting Sequences to Strings with str.join(seq)
- Splitting Strings into Lists
- Unpacking Sequences
- Dictionaries
- The update() Method
- The setdefault() Method
- Dictionary View Objects
- Deleting Dictionary Keys
- The len() Function
- Creating a Dictionary from User Input
- Sets
- *args and **kwargs
- Using *args
- Using **kwargs
- Flow Control
- Conditional Statements
- The is and is not Operators
- all() and any()
- Ternary Operator
- Loops in Python
- while Loops
- for Loops
- All True and Any True
- break and continue
- Word Guessing Game
- The else Clause
- Find the Needle
- The enumerate() Function
- Generators
- Generator Use Case: Randomly Moving Object
- The next() Function
- Rolling Dice
- List Comprehensions
- Conditional Statements
- Virtual Environments
- Virtual Environment
- Creating a Virtual Environment
- Activating and Deactivating a Virtual Environment
- Deleting a Virtual Environment
- Working with a Virtual Environment
- Virtual Environment
- Regular Expressions
- Regular Expression Syntax
- Try it
- Backreferences
- Python's Handling of Regular Expressions
- Regular Expression Syntax
- Unicode and Encoding
- Bits and Bytes
- Hexadecimal Numbers
- Converting Numbers between Number Systems
- hex(), bin(), ord(), chr(), and int()
- Encoding
- Encoding Text
- Encoding and Decoding Files in Python
- Converting a File from cp1252 to UTF-8
- Finding Confusables
- File Processing
- Opening Files
- Methods of File Objects
- Finding Text in a File
- Writing to Files
- List Creator
- The os and os.path Modules
- os
- os.path
- Opening Files
- Exception Handling
- Wildcard except Clauses
- Getting Information on Exceptions
- Raising Exceptions
- The else Clause
- The finally Clause
- Using Exceptions for Flow Control
- Running Sum
- Raising Your Own Exceptions
- Exception Hierarchy
- Python Dates and Times
- The time Module
- Clocks
- Time Structures
- Times as Strings
- Time and Formatted Strings
- time.sleep(secs)
- The datetime Module
- datetime.date objects
- datetime.time objects
- datetime.datetime Objects
- datetime.timedelta objects
- Report on Amtrak Departure Times
- The time Module
- Running Python Scripts from the Command Line
- sys.argv
- A More Useful Example
- sys.path
- sys.argv
Class Materials
Each student will receive a comprehensive set of materials, including course notes and all the class examples.
Class Prerequisites
Experience in the following would be useful for this Python class:
- Some programming experience.