Introduction To Python

Duration: 5 days

Industry: Information Technology

About this course

Introduction to Python Course

This introduction to Python training course is  designed for students who are new to the language and need to learn the basics as well as for students who have had some exposure and now want to take their skills to the next level by introducing new topics and reinforcing existing knowledge. After learning all the basics students progress to advanced features of the language and applying it to problem solving. They access databases, connect to a C program, explore multi-threaded programming, and develop a simple GUI.

What is Python?

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms, and can be freely distributed.

For more information, please check P2L's website.

Who can benefit?

This class is designed for students new to Python, or for students who have some exposure and need to expand their understanding.

This is what you'll learn

  • Installing Python and writing basic scripts
  • Using built in data structures
  • Using all flow control features
  • Reading and writing from and to files
  • Using Python’s extensive libraries and functions
  • Accessing databases
  • Connecting to C programs
  • Multi-threading
  • GUI development

Course Outline


Part 1: Basic Use

Chapter 1: Installation and Setup

  • Where to find Python
  • Installing Python
  • Testing your installation
  • Using an IDE

Chapter 2: Getting Started

  • Why Python?
  • Hello World interactive
  • Hello World command line
  • Hello World in a file
  • The print function
  • Comments
  • Line structure
  • When Things Go Wrong – Raising Exceptions

Chapter 3: Variables and Data Types

  • Variables
  • Identifiers
  • Binding
  • Data Types
  • Basic Numbers
  • Basic Strings
  • Using Tuples and Sequences
  • Using and modifying Lists
  • Using Dictionaries
  • Sequence slicing

Chapter 4: Operators

  • Basic Numeric Operators
  • Basic Arithmetic Operators
  • Bitwise
  • Augmented Assignment
  • Truncating Division
  • Comparison and Logical
  • Chaining
  • Short-circuiting
  • The Range Function

Chapter 5: Control Structures

  • The if Statement
  • For loops
  • Using enumerate
  • While loops

Chapter 6: Functions

  • Built-in functions
  • Defining functions
  • Using function objects
  • Passing arguments
  • Returning values
  • Function overloading
  • Named parameters
  • Default parameters
  • Function scope rules
  • Using the global statement
  • Pass by reference or value

Chapter 7: Exception Handling

  • The exception mechanism
  • Using the else clause
  • Using the finally clause
  • Using the raise statement

Chapter 8: Simple File I/O

  • Opening files
  • Reading and writing files
  • Reading whole files
  • Using a file interator
  • Reading and writing binary data

Chapter 9: Getting things done with modules and libraries

  • What is a module
  • Adding module names to your namespace
  • Finding modules
  • Standard modules
  • The sys module
  • The os module
  • Math with modules
  • Dates and Times

Part 2: Intermediate use

Chapter 1: Intermediate variables and operators

  • Advanced variables and datatypes
  • List comprehensions
  • Pass statement
  • Print >>
  • Ternary operator
  • Docstrings and Pydoc

Chapter 2: Strings

  • Strings and regular expressions
  • Using str() and repr()
  • Raw and Unicode strings
  • The re module

Chapter 3: Functions

  • Functions
  • Varargs with * and **
  • Defining vararg functions
  • Expanding sequences
  • Lambda functions
  • Embedding tests with __main__

Chapter 4: Classes and Object-oriented Programming

  • Defining and using Classes and Objects
  • Using the self reference
  • No privacy in Python
  • Constructors and Destructors
  • Simulating privacy in classes
  • Class data
  • Class Methods
  • Converting your object to a string
  • Inheritance
  • Overriding methods
  • Under the Object-oriented hood
  • Overloaded operators
  • Attribute access
  • Properties
  • Alternative control with __slots__

Chapter 5: Persistence

  • Persistence options
  • The marshal module
  • The pickle module
  • JSON and Python
  • Accessing the MySql or Sqlite database
  • SQL Injection
  • Parameterized Statements

Chapter 6: GUIs with Tkinter

  • The Tkinter module
  • Hello World with Tkinter

Chapter 7: Numerical Processing

  • The NumPy module
  • Using NumPy
  • Array slicing in NumPy
  • Using NumPy Functions
  • Array Features
  • Matrices

Chapter 8: Calling C code

  • How to call C code
  • The Swig tool

Chapter 9: Threads in Python

  • Creating Threads
  • Synchronization
  • Sharing Data Between Threads

Prerequisite Skills

Good computer skills and familiarity with basic programming concepts like variables, loops, and functions.

Schedule (iMVP)

Please contact P2L to schedule the dates for this course.