Python Basics Lecture and Lab 5 Day Course Course Overview Python, is an interpreted, object-oriented, high-level language that can get work done in a hurry. A tool that can improve all professionals ability to do work, Python is freely available on early all major platforms without a charge. All lessons are highly relevant for scripting within the workplace, including; data retrieval and storage from the local system, working with RESTful APIs, and decoding JSON. What You ll Learn In this course, students will learn how to get started with Python, including an overview of the Standard Library, and popular 3rd party libraries. Lessons include version controlling with git, storing data in list and dictionaries, working with objects and methods, conditionals, looping, creating functions, and building classes. Highly relevant labs enhance these skills as students learn how to use JSON pulled from APIs, manipulate Excel spreadsheets, create feature rich charts and graphs, and parse log files with the Python regular expression library. Python Basics 1. Introduction to Python Installing Python 2.7+ Installing Python 3.x Preparing to write Python Preparing to write a Python file (*.py) - Text Editors Executing a Python file Python Enhancement Proposals How to speak Python Python Statements and Control Flow Python Interpreter Overview of the Standard Library
2. Version Controlling Code Set up a github account Github essentials README course requirements How to Set up a repo Issue a Pull request How to use Issues for peer review 3. Basics of Programming Functions Objects Methods Built in Functions Functions and Arguments Print() White spacing basic rules String Literal Escape Sequences Python Variables Naming Conventions & Rules Types as Objects Sequence Types List Iteration List Enumeration Sequence Assignments Mutable vs Immutable Objects Assignment Shorthand 4. Python Basic Variables and Data Types Numeric Types Operators and Precedence / Arithmetic Expressions Integers Floating points 5. String Types Generating Strings in Python Common String Methods Formatting String Output Booleans
Printing and formatting strings Scripting with input() About raw_input() 6. Lists & Dictionaries & Tuples LIsts Mixed Lists Common List Methods Other List Operations Dictionaries Python Dictionaries Keys and Values Dictionary Building Dictionary Methods Tuples Python Time Tuples Dictionaries vs Lists vs Tuples Translating JSON to Pythonic Lists, Dictionaries and Tuples 7. If, elif, else Relational Operators Logical operators Comparison Operations simple if Statement If else statements If elif Nested if statement 8. Looping with while While usage Count controlled loop Event controlled loop Continue Break 9. Looping with for The for Loop For iteration examples Looping across data sets
Looping across lists of lists Looping across lists of dictionaries 10.Understanding Iterators The range() Function Taking the range() of len() Iterable Objects The iter() Function Looping with dictionaries Looping with lists 11.Getting Data In and Out of Python Opening Files Working with Files Read data from files Controlling Output Location Intro to working with APIs What is a REST ful API? APIs and JSON 12.Python List Comprehension Basic List Comprehensions Compound List Comprehensions 13.Creating Python Functions Function Basics Defining Functions Function Polymorphism Argument Defaults Lambdas What is if name == main Local Variables Variable Masking Creating functions using Sorted() and sort() Preventing Variable Modifications Argument Matching Methods 14.Modules & Packages Pip and pip3
Module Basics Packages Virtual environments Defined modules Import modules From import statements Namespace 15.Python Scope Naming conventions Local scope Global scope Nested scope 16.Object Oriented Python About OOP The Class Statements Defining a class Class Inheritance Classes as Objects Using Dictionaries Understanding self Class fields and constructors Data structures Subclasses (Inheritance) Multiple Inheritance Static methods 17.(Optional) Regular Expression import re library Writing regular expression Searching for data in files Using Regular Expression to search data sets Searching for data in Wireshark Traces (Python and *.pcaps)
Labs Lab 1 - Using vim Lab 2 - Using leafpad Lab 3 - Making a Github account Lab 4 - Using & Installing Python Lab 5 - The Shebang Line Lab 6 - Starting to Use Print() Lab 7 - Collecting Input() Lab 8 - Working with Lists Lab 9 - List Objects and Methods Lab 10 - Lists of Lists Lab 11 - Python Dictionaries Lab 12 - Getting dir(obj) help() and pydoc Lab 13 - String Methods Lab 14 - Copying Files and Folders Lab 15 - Moving and Renaming Files and Folders Lab 16 - Testing if conditionals Lab 17 - IPv4 Testing with if Lab 18 - Writing your own if-logic script Lab 19 - Using while, if, elif, else (Monty Python) Lab 20 - Troubleshooting while, if, elif, else Lab 21 - Starting to Learn Loops Lab 22 - Looping with for Lab 23 - for loops and range() Lab 24 - Migrating 2.x to 3.x py Lab 25 - Parsing Log Files Lab 26 - Write to Files Lab 27 - Read from Files Lab 28 - Creating Functions Lab 29 - Best Practice and pylint Lab 30 - pip and import Lab 31 - Exploring Network Interfaces Lab 32 - Defining Functions Lab 33 - Scripting Commands with Python Lab 34 - Producing Graphs and Charts Lab 35 - os.walk() the Directory Tree Lab 36 - Python and Excel Lab 37 - Python, APIs, and JSON
Lab 38 - Searching with Regular Expressions Lab 39 - Creating objects in Python from "Scratch" Lab 40 - Inheritance Lab 41 - Using Classes Prerequisites Keyboard proficiency Who Should Attend This course is an appropriate introduction to students of any background looking to get started with Python. System administrators, network engineers, managers, and those with development skills in other programming languages will find the lessons and labs highly relevant to their disciplines. Follow-on Courses Recommended Follow up: APIs and API Design with Python (5 days) Recommended Follow up: Python for Network Automation (5 days)