Introduction to Python
- Course Length:
- 4 Days
- Course Description:
- This course introduces the student to the Python language. Upon completion of this class, the student will be able to write non trivial Python programs dealing with a wide variety of subject matter domains. Topics include language components, the IDLE environment, control flow constructs, I/O, sequences, collections, mappings, classes, GUIs, modules, regular expressions, and debugging. The course is supplemented with many hands on labs using either Linux or Windows.
- Who Should Attend:
- This course is designed for anyone who needs to learn how to write programs in Python.
- Benefits of Attendance:
-
Upon completion of this course, students will be able to:
- Execute Python code in a variety of environments
- Use correct Python syntax in Python programs
- Use the correct Python control flow construct
- Write Python programs using various collection data types
- Write home grown Python functions
- Use many of the standard Python modules such as os, sys, math, and time
- Trap various errors via the Python Exception Handling model
- Use the IO model in Python to read and write disk files
- Create their own classes and use existing Python classs
- Understand and use the Object Oriented paradigm in Python programs
- Use the Python Regular Expression capabilities for data verification
- Write Graphical User Interfaces via the use of the Tkinter module
- Prerequisites:
- Students should have taken the Software Development for Non-Programmers course or have some experience with at least one programming language. Typically, students in this course will have already programmed in either C, C++, Java, Perl, Ruby, VB, or anything equivalent to these languages.
- Course Outline:
-
- Chapter 1: An Introduction to Python
- Introductory Remarks about Python
- Strengths and Weaknesses
- A Brief History of Python
- Python Versions
- Installing Python
- Environment Variables
- Executing Python from the Command Line
- IDLE
- Editing Python Files
- Getting Help
- Dynamic Types
- Python Reserved Words
- Naming Conventions
- Chapter 2: Basic Python Syntax
- Introduction
- Basic Syntax
- Comments
- String Values
- String Operations
- The String format Method
- String Slicing
- String Operators
- Numeric Data Types
- Conversions
- Simple Input and Output
- The print Function
- Chapter 3: Language Components
- Introduction
- Control Flow and Syntax
- Indenting
- The if Statement
- Relational Operators
- Logical Operators
- True or False
- Bit Wise Operators
- The while Loop
- The for Loop
- Chapter 4: Collections
- Introduction
- Lists
- Dynamic Lists
- Sets
- Dictionaries
- Tuples
- Copying Collections
- Chapter 5: Functions
- Introduction
- Defining Your Own Functions
- Parameters
- Documentation
- Keyword and Optional Parameters
- Passing Collections to a Function
- Variable Number of Arguments
- Scope
- Functions - First Class Citizens
- Some Advanced List Functions
- Lambda
- Modules
- Standard Modules - sys
- Standard Modules - math
- Standard Modules - time
- The dir() Function
- Chapter 6: Exceptions
- Errors
- Run Time Errors
- The Exception Model
- Exception Hierarchy
- Handling Multiple Exceptions
- raise
- assert
- Writing Your Own Exception Classes
- Chapter 7: Input and Output
- Introduction
- Data Streams
- Creating Your Own Data Streams
- Access Modes
- Writing Data to a File
- Reading Data From a File
- Additional File Methods
- Using Pipes as Data Streams
- Handling IO Exceptions
- Working with Directories
- Metadata
- The Pickle Module
- Chapter 8: Classes in Python
- Classes in Python
- Principles of Object Orientation
- Creating Classes
- Instance Methods
- File Organization
- Pydoc
- Special Methods
- Class Variables
- Inheritance
- Polymorphism
- Type Identification
- Custom Exception Classes
- Chapter 9: Regular Expressions
- Introduction
- Simple Character Matches
- Character and Character Classes
- Quantifiers
- Greedy Matches
- Grouping
- The re Module
- Substituting
- Splitting
- Compiling Regular Expressions
- Flags
- Chapter 10: Writing GUI's in Python
- Introduction
- Components and Events
- An Example GUI
- The root Component
- Adding a Button
- Entry Widgets
- Text Widgets
- Checkbuttons
- Radiobuttons
- Listboxes
- Frames
- Menus
- Binding Events to Widgets
- Chapter 1: An Introduction to Python