|
| 1 | +Table of Contents |
| 2 | +================= |
| 3 | + |
| 4 | +* [Introduction](#introduction) |
| 5 | + * [Introduction to Programming Languages](#introduction-to-programming-languages) |
| 6 | + * [Introduction to Python](#introduction-to-python) |
| 7 | + * [Advantages of Python](#advantages-of-python) |
| 8 | + * [Installing Python in Windows](#installing-python-in-windows) |
| 9 | + * [Installing Python in macOS (Apple)](#installing-python-in-macos-apple) |
| 10 | + * [Execution Modes](#execution-modes) |
| 11 | + * [Interactive Mode of Execution](#interactive-mode-of-execution) |
| 12 | + * [Script Mode of Execution](#script-mode-of-execution) |
| 13 | +* [Python Fundamentals](#python-fundamentals) |
| 14 | + * [Tokens: Introduction](#tokens-introduction) |
| 15 | + * [Tokens: Keywords](#tokens-keywords) |
| 16 | + * [Tokens: Identifiers](#tokens-identifiers) |
| 17 | + * [Tokens: Literals](#tokens-literals) |
| 18 | + * [Numeric Literals](#numeric-literals) |
| 19 | + * [Integer Literals](#integer-literals) |
| 20 | + * [Floating Point Literals](#floating-point-literals) |
| 21 | + * [Imaginary Literals](#imaginary-literals) |
| 22 | + * [Boolean Literals](#boolean-literals) |
| 23 | + * [String Literals](#string-literals) |
| 24 | + * [Special Literal](#special-literal) |
| 25 | + * [Collection of Literals](#collection-of-literals) |
| 26 | + * [Tokens: Operators](#tokens-operators) |
| 27 | + * [Tokens: Delimiters](#tokens-delimiters) |
| 28 | + * [Grouping](#grouping) |
| 29 | + * [Punctuation, Decoration and Annotation](#punctuation-decoration-and-annotation) |
| 30 | + * [Assignment/Binding](#assignmentbinding) |
| 31 | + * [Character Set](#character-set) |
| 32 | + * [Blocks and Indentation](#blocks-and-indentation) |
| 33 | + * [Comments](#comments) |
| 34 | + * [Single Line Comments](#single-line-comments) |
| 35 | + * [Multiline comments](#multiline-comments) |
| 36 | +* [Variables, Objects & Data Types](#variables-objects--data-types) |
| 37 | + * [What are Objects & Variables?](#what-are-objects--variables) |
| 38 | + * [Variables & Assignment Statements](#variables--assignment-statements) |
| 39 | + * [Assignment](#assignment) |
| 40 | + * [Deletion](#deletion) |
| 41 | + * [Multiple Assignment](#multiple-assignment) |
| 42 | + * [Tuple Swapping](#tuple-swapping) |
| 43 | + * [Built-in Data Types](#built-in-data-types) |
| 44 | + * [Numeric Types](#numeric-types) |
| 45 | + * [Integer Numbers](#integer-numbers) |
| 46 | + * [Real or Floating-point Numbers](#real-or-floating-point-numbers) |
| 47 | + * [Complex Numbers](#complex-numbers) |
| 48 | + * [Boolean](#boolean) |
| 49 | + * [Sequence Types](#sequence-types) |
| 50 | + * [String](#string) |
| 51 | + * [List](#list) |
| 52 | + * [Tuple](#tuple) |
| 53 | + * [Set Type](#set-type) |
| 54 | + * [Mapping Type](#mapping-type) |
| 55 | + * [Special Type](#special-type) |
| 56 | + * [Type Checking](#type-checking) |
| 57 | + * [Type Casting](#type-casting) |
| 58 | + * [Implicit Type Casting](#implicit-type-casting) |
| 59 | + * [Explicit Type Casting](#explicit-type-casting) |
| 60 | + * [int()](#int) |
| 61 | + * [float()](#float) |
| 62 | + * [str()](#str) |
| 63 | + * [tuple()](#tuple-1) |
| 64 | + * [list()](#list-1) |
| 65 | + * [set()](#set) |
| 66 | + * [Mutable & Immutable Data Types](#mutable--immutable-data-types) |
| 67 | + * [Immutable Data Types](#immutable-data-types) |
| 68 | + * [Mutable Data Types](#mutable-data-types) |
| 69 | +* [Input / Output](#input--output) |
| 70 | + * [How to Accept User Input](#how-to-accept-user-input) |
| 71 | + * [Displaying Output](#displaying-output) |
| 72 | +* [Operators & Expressions](#operators--expressions) |
| 73 | + * [Introduction to Operators](#introduction-to-operators) |
| 74 | + * [Unary Operators](#unary-operators) |
| 75 | + * [Binary Operators](#binary-operators) |
| 76 | + * [Operators in Python](#operators-in-python) |
| 77 | + * [Arithmetic Operators](#arithmetic-operators) |
| 78 | + * [Addition](#addition) |
| 79 | + * [Subtraction](#subtraction) |
| 80 | + * [Multiplication](#multiplication) |
| 81 | + * [Division](#division) |
| 82 | + * [Floor Division](#floor-division) |
| 83 | + * [Modulus](#modulus) |
| 84 | + * [Exponent](#exponent) |
| 85 | + * [Relational Operators](#relational-operators) |
| 86 | + * [Equals to](#equals-to) |
| 87 | + * [Not equal to](#not-equal-to) |
| 88 | + * [Greater than](#greater-than) |
| 89 | + * [Greater than or equal to](#greater-than-or-equal-to) |
| 90 | + * [Less than](#less-than) |
| 91 | + * [Less than or equal to](#less-than-or-equal-to) |
| 92 | + * [Assignment Operators](#assignment-operators) |
| 93 | + * [-=](#-) |
| 94 | + * [*=](#-1) |
| 95 | + * [/=](#-2) |
| 96 | + * [//=](#-3) |
| 97 | + * [**=](#-4) |
| 98 | + * [%=](#-5) |
| 99 | + * [Logical Operators](#logical-operators) |
| 100 | + * [Logical State of Operands](#logical-state-of-operands) |
| 101 | + * [not](#not) |
| 102 | + * [or](#or) |
| 103 | + * [and](#and) |
| 104 | + * [Identity Operators](#identity-operators) |
| 105 | + * [Membership Operators](#membership-operators) |
| 106 | + * [Expressions](#expressions) |
| 107 | + * [Chained Expression](#chained-expression) |
| 108 | + * [Conditional Expression](#conditional-expression) |
| 109 | + * [Operator Precedence with Examples](#operator-precedence-with-examples) |
| 110 | + * [Exercises](#exercises) |
| 111 | + * [Example 1](#example-1) |
| 112 | + * [Example 2](#example-2) |
| 113 | + * [Example 3](#example-3) |
| 114 | + * [Example 4](#example-4) |
| 115 | + * [Example 5](#example-5) |
| 116 | + * [Example 6](#example-6) |
| 117 | +* [Errors & Exception Handling](#errors--exception-handling) |
| 118 | + * [Error Types](#error-types) |
| 119 | + * [Syntax Error](#syntax-error) |
| 120 | + * [Script Mode](#script-mode) |
| 121 | + * [Interactive Mode](#interactive-mode) |
| 122 | + * [Runtime Error](#runtime-error) |
| 123 | + * [Examples](#examples) |
| 124 | + * [ZeroDivisionError](#zerodivisionerror) |
| 125 | + * [NameError](#nameerror) |
| 126 | + * [KeyError](#keyerror) |
| 127 | + * [TypeError](#typeerror) |
| 128 | + * [Logical Error](#logical-error) |
| 129 | + * [Example](#example) |
| 130 | + * [Exceptions](#exceptions) |
| 131 | + * [raise](#raise) |
| 132 | + * [assert](#assert) |
| 133 | + * [Exception Handling](#exception-handling) |
| 134 | +* [Control Flow](#control-flow) |
| 135 | + * [Introduction to Control Flow](#introduction-to-control-flow) |
| 136 | + * [Sequential Flow](#sequential-flow) |
| 137 | + * [Selection Statements: if .. else](#selection-statements-if--else) |
| 138 | + * [Examples](#examples-1) |
| 139 | + * [Absolute Value](#absolute-value) |
| 140 | + * [Sorting 3 Numbers](#sorting-3-numbers) |
| 141 | + * [Divisibility](#divisibility) |
| 142 | + * [Iteration: for](#iteration-for) |
| 143 | + * [List Iteration](#list-iteration) |
| 144 | + * [Tuple Iteration](#tuple-iteration) |
| 145 | + * [String Iteration](#string-iteration) |
| 146 | + * [Range Iteration](#range-iteration) |
| 147 | + * [Example #1](#example-1-1) |
| 148 | + * [Example #2](#example-2-1) |
| 149 | + * [Example #3](#example-3-1) |
| 150 | + * [Example #4](#example-4-1) |
| 151 | + * [Exercises](#exercises-1) |
| 152 | + * [Compound Interest](#compound-interest) |
| 153 | + * [Factorial](#factorial) |
| 154 | + * [Iteration: while](#iteration-while) |
| 155 | + * [Exercises](#exercises-2) |
| 156 | + * [Compound Interest](#compound-interest-1) |
| 157 | + * [Factorial](#factorial-1) |
| 158 | + * [Jump Statements](#jump-statements) |
| 159 | + * [pass](#pass) |
| 160 | + * [Syntactical Requirement](#syntactical-requirement) |
| 161 | + * [Skipping Code Execution](#skipping-code-execution) |
| 162 | + * [Placeholders](#placeholders) |
| 163 | + * [break](#break) |
| 164 | + * [continue](#continue) |
| 165 | + * [Nested Loops](#nested-loops) |
| 166 | + * [Factorial](#factorial-2) |
| 167 | + * [Nested Loop - break](#nested-loop---break) |
| 168 | +* [Strings](#strings) |
| 169 | + * [Strings: Introduction & Creation](#strings-introduction--creation) |
| 170 | + * [Escape Characters](#escape-characters) |
| 171 | + * [Unicode Support](#unicode-support) |
| 172 | + * [Other Types to String](#other-types-to-string) |
| 173 | + * [Accessing Characters of a String](#accessing-characters-of-a-string) |
| 174 | + * [Length of String](#length-of-string) |
| 175 | + * [String Operations](#string-operations) |
| 176 | + * [Slicing](#slicing) |
| 177 | + * [Membership](#membership) |
| 178 | + * [Concatenation](#concatenation) |
| 179 | + * [Repetition](#repetition) |
| 180 | + * [Introduction to String Methods](#introduction-to-string-methods) |
| 181 | + * [Convert Case of Strings](#convert-case-of-strings) |
| 182 | + * [lower()](#lower) |
| 183 | + * [upper()](#upper) |
| 184 | + * [swapcase()](#swapcase) |
| 185 | + * [capitalize()](#capitalize) |
| 186 | + * [title()](#title) |
| 187 | + * [Check Characters of a String](#check-characters-of-a-string) |
| 188 | + * [isalpha()](#isalpha) |
| 189 | + * [isdigit()](#isdigit) |
| 190 | + * [isalnum()](#isalnum) |
| 191 | + * [isascii()](#isascii) |
| 192 | + * [islower()](#islower) |
| 193 | + * [isupper()](#isupper) |
| 194 | + * [isspace()](#isspace) |
| 195 | + * [istitle()](#istitle) |
| 196 | + * [Split a String](#split-a-string) |
| 197 | + * [partition()](#partition) |
| 198 | + * [split()](#split) |
| 199 | + * [Strip Characters from a String](#strip-characters-from-a-string) |
| 200 | + * [lstrip()](#lstrip) |
| 201 | + * [rstrip()](#rstrip) |
| 202 | + * [strip()](#strip) |
| 203 | + * [Check Prefix or Suffix in a String](#check-prefix-or-suffix-in-a-string) |
| 204 | + * [Find & Replace Characters in a String](#find--replace-characters-in-a-string) |
| 205 | + * [count()](#count) |
| 206 | + * [find()](#find) |
| 207 | + * [rfind()](#rfind) |
| 208 | + * [index()](#index) |
| 209 | + * [rindex()](#rindex) |
| 210 | + * [replace()](#replace) |
| 211 | + * [Traversing a String](#traversing-a-string) |
| 212 | + * [for](#for) |
| 213 | + * [while](#while) |
| 214 | +* [List](#list-2) |
| 215 | + * [What is a Python List? How to Create a List?](#what-is-a-python-list-how-to-create-a-list) |
| 216 | + * [Accessing Items of a List](#accessing-items-of-a-list) |
| 217 | + * [Length of List](#length-of-list) |
| 218 | + * [Negative Indexing](#negative-indexing) |
| 219 | + * [Modifying a List](#modifying-a-list) |
| 220 | + * [Removing Item from a List](#removing-item-from-a-list) |
| 221 | + * [List Operations](#list-operations) |
| 222 | + * [Membership](#membership-1) |
| 223 | + * [Concatenation](#concatenation-1) |
| 224 | + * [Repetition](#repetition-1) |
| 225 | + * [Slicing](#slicing-1) |
| 226 | + * [Traversing a List](#traversing-a-list) |
| 227 | + * [Direct Traversal](#direct-traversal) |
| 228 | + * [Location or Index Based Traversal](#location-or-index-based-traversal) |
| 229 | + * [Built-in Functions that can be used for a List](#built-in-functions-that-can-be-used-for-a-list) |
| 230 | + * [Introduction to List Methods](#introduction-to-list-methods) |
| 231 | + * [Adding Items to a List](#adding-items-to-a-list) |
| 232 | + * [Removing Items from a List](#removing-items-from-a-list) |
| 233 | + * [Counting or Locating Items in a List](#counting-or-locating-items-in-a-list) |
| 234 | + * [Reversing Items](#reversing-items) |
| 235 | + * [Sorting a List](#sorting-a-list) |
| 236 | + * [Copying a List](#copying-a-list) |
| 237 | + * [Nested List](#nested-list) |
| 238 | + * [List Comprehension](#list-comprehension) |
| 239 | + * [Member-wise Operation](#member-wise-operation) |
| 240 | + * [Filtering or Subsequence](#filtering-or-subsequence) |
| 241 | + * [Sample Programs](#sample-programs) |
| 242 | + * [Min, Max and Mean](#min-max-and-mean) |
| 243 | + * [Without Using Built-in Functions](#without-using-built-in-functions) |
| 244 | + * [Using Built-in Functions](#using-built-in-functions) |
| 245 | + * [Linear Search](#linear-search) |
| 246 | + * [Frequency of Elements](#frequency-of-elements) |
| 247 | + * [Without Using Built-in Functions](#without-using-built-in-functions-1) |
| 248 | + * [Using Built-in Functions](#using-built-in-functions-1) |
| 249 | +* [Tuple](#tuple-2) |
| 250 | + * [List vs Tuple](#list-vs-tuple) |
| 251 | + * [How to Create Tuple?](#how-to-create-tuple) |
| 252 | + * [tuple()](#tuple-3) |
| 253 | + * [What is a Singleton?](#what-is-a-singleton) |
| 254 | + * [Accessing Items of a Tuple](#accessing-items-of-a-tuple) |
| 255 | + * [Length of Tuple](#length-of-tuple) |
| 256 | + * [Negative Indexing](#negative-indexing-1) |
| 257 | + * [Tuples are Immutable](#tuples-are-immutable) |
| 258 | + * [Tuple Operations](#tuple-operations) |
| 259 | + * [Membership](#membership-2) |
| 260 | + * [Concatenation](#concatenation-2) |
| 261 | + * [Repetition](#repetition-2) |
| 262 | + * [Tuple Slicing](#tuple-slicing) |
| 263 | + * [Traversing a Tuple](#traversing-a-tuple) |
| 264 | + * [Direct Traversal](#direct-traversal-1) |
| 265 | + * [Location or Index Based Traversal](#location-or-index-based-traversal-1) |
| 266 | + * [Built-in Functions that can be used for a Tuple](#built-in-functions-that-can-be-used-for-a-tuple) |
| 267 | + * [Locating Items in a Tuple](#locating-items-in-a-tuple) |
| 268 | + * [Counting the Occurrence of an Item](#counting-the-occurrence-of-an-item) |
| 269 | + * [New Tuple with Reversed Items](#new-tuple-with-reversed-items) |
| 270 | + * [New Tuple with Sorted Items](#new-tuple-with-sorted-items) |
| 271 | + * [Nested Tuple](#nested-tuple) |
| 272 | + * [Understanding the Immutable Nature of Tuples](#understanding-the-immutable-nature-of-tuples) |
| 273 | +* [Dictionary](#dictionary) |
| 274 | + * [What is a Dictionary?](#what-is-a-dictionary) |
| 275 | + * [How to Create a Dictionary](#how-to-create-a-dictionary) |
| 276 | + * [Key: Value Pairs](#key-value-pairs) |
| 277 | + * [Sequence of (key, value) Tuples](#sequence-of-key-value-tuples) |
| 278 | + * [Keyword/Named Arguments](#keywordnamed-arguments) |
| 279 | + * [Key and Value Lists](#key-and-value-lists) |
| 280 | + * [Keys with Default Value](#keys-with-default-value) |
| 281 | + * [Accessing Items (Key:Value) of a Dictionary](#accessing-items-keyvalue-of-a-dictionary) |
| 282 | + * [Index Operator []](#index-operator-) |
| 283 | + * [get()](#get) |
| 284 | + * [Updating a Dictionary](#updating-a-dictionary) |
| 285 | + * [Index Operator []](#index-operator--1) |
| 286 | + * [update()](#update) |
| 287 | + * [setdefault()](#setdefault) |
| 288 | + * [Removing an Item (Key:Value) from a Dictionary](#removing-an-item-keyvalue-from-a-dictionary) |
| 289 | + * [del](#del) |
| 290 | + * [clear()](#clear) |
| 291 | + * [pop()](#pop) |
| 292 | + * [popitem()](#popitem) |
| 293 | + * [Dictionary Operations](#dictionary-operations) |
| 294 | + * [Membership](#membership-3) |
| 295 | + * [Union](#union) |
| 296 | + * [Traversing a Dictionary](#traversing-a-dictionary) |
| 297 | + * [Direct Traversal](#direct-traversal-2) |
| 298 | + * [Traversing Using Dictionary Methods](#traversing-using-dictionary-methods) |
| 299 | + * [Built-in Functions for a Dictionary](#built-in-functions-for-a-dictionary) |
| 300 | + * [Number of Items](#number-of-items) |
| 301 | + * [Min and Max](#min-and-max) |
| 302 | + * [Creating a Copy of a Dictionary](#creating-a-copy-of-a-dictionary) |
| 303 | + * [Nested Dictionary](#nested-dictionary) |
| 304 | + * [Sample Programs](#sample-programs-1) |
| 305 | + * [Frequency of Characters](#frequency-of-characters) |
| 306 | + * [Salary Book](#salary-book) |
| 307 | +* [Python Standard Library](#python-standard-library) |
| 308 | + * [Built-in Functions](#built-in-functions) |
| 309 | + * [Mathematical Functions](#mathematical-functions) |
| 310 | + * [abs()](#abs) |
| 311 | + * [round()](#round) |
| 312 | + * [sum()](#sum) |
| 313 | + * [min()](#min) |
| 314 | + * [max()](#max) |
| 315 | + * [pow()](#pow) |
| 316 | + * [divmod()](#divmod) |
| 317 | + * [Type Functions](#type-functions) |
| 318 | + * [Type Checking](#type-checking-1) |
| 319 | + * [Built-in Type Functions](#built-in-type-functions) |
| 320 | + * [I/O Functions](#io-functions) |
| 321 | + * [input()](#input) |
| 322 | + * [print()](#print) |
| 323 | + * [open()](#open) |
| 324 | + * [Base/Unicode Conversion Functions](#baseunicode-conversion-functions) |
| 325 | + * [bin()](#bin) |
| 326 | + * [oct()](#oct) |
| 327 | + * [hex()](#hex) |
| 328 | + * [ord()](#ord) |
| 329 | + * [chr()](#chr) |
| 330 | + * [What are Built-in Modules?](#what-are-built-in-modules) |
| 331 | + * [math Module](#math-module) |
| 332 | + * [Constants](#constants) |
| 333 | + * [Functions](#functions) |
| 334 | + * [fabs()](#fabs) |
| 335 | + * [gcd()](#gcd) |
| 336 | + * [ceil()](#ceil) |
| 337 | + * [floor()](#floor) |
| 338 | + * [fmod()](#fmod) |
| 339 | + * [pow()](#pow-1) |
| 340 | + * [sqrt()](#sqrt) |
| 341 | + * [sin(), cos() & tan()](#sin-cos--tan) |
| 342 | + * [factorial()](#factorial-3) |
| 343 | + * [random Module](#random-module) |
| 344 | + * [random()](#random) |
| 345 | + * [Random Integer from Range](#random-integer-from-range) |
| 346 | + * [statistics Module](#statistics-module) |
| 347 | + * [Mean](#mean) |
| 348 | + * [Median](#median) |
| 349 | + * [Mode](#mode) |
| 350 | +* [File Handling](#file-handling) |
| 351 | + * [File Handling in Python - Introduction & Overview](#file-handling-in-python---introduction--overview) |
| 352 | + * [Text Files vs Binary Files - Use Case, File Formats, Examples](#text-files-vs-binary-files---use-case-file-formats-examples) |
| 353 | + * [File Opening & Closing](#file-opening--closing) |
| 354 | + * [File Reading](#file-reading) |
| 355 | + * [Sequential Reading](#sequential-reading) |
| 356 | + * [read()](#read) |
| 357 | + * [readline()](#readline) |
| 358 | + * [readlines()](#readlines) |
| 359 | + * [Ad-hoc Reading](#ad-hoc-reading) |
| 360 | + * [tell()](#tell) |
| 361 | + * [seek()](#seek) |
| 362 | + * [Writing a File](#writing-a-file) |
| 363 | + * [write()](#write) |
| 364 | + * [writelines()](#writelines) |
| 365 | + * [Reading & Writing Binary Files using pickle Module](#reading--writing-binary-files-using-pickle-module) |
| 366 | + * [Dumping Data](#dumping-data) |
| 367 | + * [Loading Data](#loading-data) |
| 368 | + * [Example: Traversing a Binary File](#example-traversing-a-binary-file) |
| 369 | + * [Reading & Writing a CSV File using csv Module](#reading--writing-a-csv-file-using-csv-module) |
| 370 | + * [Reading CSV File](#reading-csv-file) |
| 371 | + * [Example 1](#example-1-2) |
| 372 | + * [Example 2](#example-2-2) |
| 373 | + * [Writing CSV File](#writing-csv-file) |
| 374 | + * [Example 3](#example-3-2) |
| 375 | +* [User Defined Functions, Modules & Packages](#user-defined-functions-modules--packages) |
| 376 | + * [User Defined Functions](#user-defined-functions) |
| 377 | + * [Function Structure](#function-structure) |
| 378 | + * [Function Header](#function-header) |
| 379 | + * [Function Body](#function-body) |
| 380 | + * [Parameters and Arguments](#parameters-and-arguments) |
| 381 | + * [Scope of Variables](#scope-of-variables) |
| 382 | + * [Local Variables](#local-variables) |
| 383 | + * [Global Variables](#global-variables) |
| 384 | + * [Passing Objects of Mutable Type to a Function](#passing-objects-of-mutable-type-to-a-function) |
| 385 | + * [List](#list-3) |
| 386 | + * [Dictionary](#dictionary-1) |
| 387 | + * [What is a Module? How to Create a Module?](#what-is-a-module-how-to-create-a-module) |
| 388 | + * [Executable Scripts / Modules](#executable-scripts--modules) |
| 389 | + * [What is a Package? Introduction to PyPi. How to Create a Python Package?](#what-is-a-package-introduction-to-pypi-how-to-create-a-python-package) |
| 390 | + |
| 391 | + |
1 | 392 | # Introduction
|
2 | 393 |
|
3 | 394 | ## Introduction to Programming Languages
|
|
0 commit comments