Python Fundamentals
Build confidence in Python through a focused 2-day fundamentals program covering scripting, flow control, files, modules, object-oriented programming, and practical automation basics.
Duration
2 Days
Overview
This 2-day instructor-led Python fundamentals program helps participants build confidence in Python scripting, core language constructs, file handling, modules, object-oriented programming, and practical text processing.
Introduction
Python is widely used for scripting, automation, backend development, data work, and rapid problem solving. This instructor-led program introduces participants to the core language features that make Python productive and approachable, while also covering practical topics such as file handling, modules, exception management, regular expressions, and object-oriented programming.
Topics Covered
- An Overview of Python
- Getting Started
- Flow Control
- Sequence Data
- Defining Functions
- Working with Files
- Dictionaries and Sets
- Python Classes
- Errors and Exception Handling
- Using Modules
- Regular Expressions and Standard Library Highlights
Audience Profile
Anyone who needs to learn how to write programs in Python, as well as participants who want strong exposure to Python as a first programming language.
Prerequisites
There are no formal prerequisites for this course, but some programming background is preferred.
Day 1 - Python Foundations and Core Language Skills
1. An Overview of Python
- What is Python
- Interpreted languages
- Advantages and disadvantages
- Downloading and installing
- Choosing a Python version
- Where to find documentation
- Running Python scripts
- Structure of a Python script
- Using the interpreter interactively
- Running standalone scripts on Windows and Unix
2. Getting Started
- Using variables
- String types: normal, raw, and Unicode
- String operators and expressions
- Math operators and expressions
- Writing to the screen
- Command line parameters
- Reading from the keyboard
3. Flow Control
- About flow control
- Indentation in Python
- The if statement
- The elif statement
- while loops
- Using lists
- The for statement
- The range() function
4. Sequence Data
- Lists
- Tuples
- Sets
- Dictionaries
- Array slicing
- Sequence operations
5. Defining Functions
- Function definition syntax
- Formal parameters
- Global versus local variables
- Passing parameters
- Returning values
- Facilitating code reuse
6. Lab 1: Core Python Scripting
- Create Python scripts using variables and expressions
- Build decision-making and loop examples
- Write reusable functions
- Practice working with lists, tuples, sets, and dictionaries
Day 2 - Files, Modules, OOP, and Text Processing
7. Working with Files
- Text file I/O overview
- Opening a text file
- Reading text files
- Writing to text files
- Working with raw binary data
- Using the pickle module
- Opening Excel files
- Reading from Excel files
- Writing data into Excel files
8. Dictionaries and Sets
- Dictionary overview
- Creating dictionaries
- Dictionary functions
- Fetching keys and values
- Testing for element existence
- Deleting elements
9. Python Classes
- Object-oriented programming concepts
- Defining classes
- Class methods and data
- Constructors
- Objects and instance methods
- Instance data
- Destructors
- Interfaces
- Inheritance
10. Errors and Exception Handling
- Dealing with syntax errors
- Exceptions
- Handling exceptions with try and except
- Cleaning up with finally
- Writing more robust Python scripts
11. Using Modules
- What is a module
- The import statement
- Function aliases
- Packages
- Installing packages from PyPI
- Standard modules: sys, math, and time
12. Regular Expressions and Standard Library Highlights
- Pattern matching with regular expressions
- Parsing data
- Subexpressions
- Complex substitutions
- Regular expression tips and tricks
- Working with the operating system
- Grabbing web pages
- Sending email
- Using glob for filename wildcards
- Working with datetime
- Working with compressed files
13. Lab 2: Practical Python Automation
- Read and write files using Python
- Process tabular data and Excel input
- Create classes and reusable modules
- Apply exception handling and regular expressions