Course Outlines
Total Page:16
File Type:pdf, Size:1020Kb
COURSE NAME PYTHON PROGRAMMING OVERVIEW OBJECTIVES Python is a general-purpose, versatile, and popular How Python works and its place in the world of programming language. It is a great first language programming languages; to work with and because it is concise and easy to read, and it is also manipulate strings; to perform math operations; to a good language to have in any programmer’s stack work with Python sequences; to collect user input as it can be used for everything from web and output results; flow control processing; to write development to software development and scientific to, and read from, files; to write functions; to handle applications. exception; and work with dates and times. WHO SHOULD ATTEND PRE-REQUISITES Students new to the language. Some experience with other programming languages DELIVERY METHOD DURATION Instructor-led virtual course 5 days (40 hours) COURSE OUTLINE PYTHON INSTALLATION LOOPS Python Distributions (ActivePython, Anaconda, For(each) loop MiniConda) Absence of traditional for (i=0, i<n, i++) loop Additional Modules (Pip, conda, easy_install) Basic Examples with foreach loop PYTHON INTRODUCTION & BASICS Emulating Traditional for loops using range(n) The Python interpreter While Loops Working with command-line/IDE FUNCTIONS Python Data Types Def Keyword Built in operators, functions and methods Functions without args Data and type introspection basics: type (), dir() Functions with fixed num of args Syntax (Blocks and indentation) Functions with variable number of args and default Concepts (Scope, lifetime, Garbage collection) values Exercises to Try Above Concepts Returning more than one values LISTS, TUPLES, SETS Keyword based args Defining lists IF-ELSE-ELIF Indexes and slices Basic if conditions Accessing operations Combining logical conditions with ‘and’, ‘or’, ‘not’ Modifying operations Nested if’s, if and for for(each) loops; comparison to traditional for loop Multi-level elif’s Immutability and tuples Absence of switch, ?: operator Defining sets Checking membership using in FILE I/O CSV MODULES Open Function CSV fomat File Objects and Supported Methods Tab delimiters instead of ‘,’ Reading with for Loop Variants of CSV Explicit Reading with read(), readline(), readlines() Reading csv files outfile.write() Dict references Flushing output file handles Writing CSV files Exercises: cat, tail, head, tac, wc -l JSON STRINGS AND REGULAR EXPRESSIONS JSON format Str and string types Field data and formats Operators and methods JSON data parsed to dict’s ‘re’ module Modifying dict data Basics of Regular Expressions Writing out dict data to JSON Match objects BSON (Binary JSON to save space, security) Submatches XML .findall() XML Format .subs() XML Tags, Attributes EXERCISE OF THE DAY, Q&A Recursive Tags One exercise covering all the above Searching within XML Doubt clearing and Q&A Modifying, Writing out XML DICTIONARIES Preserving XML Structure Key-value pair pattern REPORT GENERATION Defining dict’s Formatting Text Accessing dict’s % operator Adding/Modifying elements .format() Method Ways for Iteration Sending mails via mail/mailx modules Application areas for dictionaries LOGGING COMBINED EXAMPLES Logging Module With lists, dictionaries, for loops and if-else, File and Creating a Logger I/O and strings Handler Hands-on examples to consolidate learning on all Formatter these topics Filter MODULES Logging Levels: INFO, WARN, DEBUG, ERROR, What are modules? CRITICAL, FATAL Pre-installed modules Custom Logging levels Installing new modules OS logging Python repository Multiprocess logging and synchronization Pip CLASS BASICS Easy_install __init__ STANDARD PYTHON MODULES Self sys module Private vs Public Convention __builtin__ and __future__ modules Magic Functions os module (Filesystem functions, os.path, os.walk Object Creation Time and Date Time Modules Type of Objects RELATIONAL DATABASE INTERACTION Inheritance, Multiple Inheritance CRUD operations SQL Python DB API 2.0 MySQLdb module (connect(), execute(), fetch*()) Other DB’s: postgresql, oracle Nosql DB’s ERRORS & EXCEPTIONS traceback objects Standard exception hierarchy Assertions exception payloads EXERCISE defining new exceptions Full-fledged python example chaining exceptions SUMMARY, WRAP-UP, Q&A CONSEC LEARN [email protected] +971 2 642 2552 +971 56 502 8808 All rights reserved CONSEC Training Institute L.L.C. .