The Essential Python Tutorial

Basics

Introduction to Python Checking Python Version Outputting data to the screen Python Philosophy Comments Variables Displaying a variable on the screen Mathematical operations with numbers Mathematical operations with variables Shortened operations Priority of mathematical operations Equal priority Grouping brackets Nuances of grouping Length of number Floating point numbers Negative numbers Remainder from division Exponentiation Priority of exponentiation Lines Addition of strings Multiplication of rows String symbols Escaping string characters Line length Multi-line strings Logical values Value None Strong Typing in Python Convert to string Conversion to number Lines with numbers Getting characters from a number Convert to floating point Function input

Lists

Introduction to lists Creating Lists with Square Brackets Creating Lists with the list Function Splitting a String into a List Single list item List length The last item in the list Changing elements Adding items to the end of a list Adding elements by position Combining lists with the extend method Merging lists Add to list Deleting elements with the del operator Removing elements by value Getting and Removing an Element Delete all elements Finding the index of an element by its value Presence of an element in a list Counting items in a list Reverse the order of elements in a list Sorting in the original list Sorting in a copy of the list Merge a list into a string

Corteges

Introduction to Tuples Creating a tuple An alternative way to create a tuple Tuple of one element Alternative syntax A single element of a tuple Changing elements Length of the motorcade Concatenation of tuples Multiplication of tuples Presence of an element in a tuple Unpacking tuples Convert to tuple Converting a tuple to a list Merge a tuple into a string

Slices

Introduction to Slices Slice in range of positions Slice from position Cut to position Slice with negative positions Sampling step Slice with sampling step only The whole section Reversal of sequence Removing Elements Using Slices

Dictionaries

Introduction to Dictionaries An alternative way to create a dictionary Dictionary item value Changing the value of an element Adding an item to a dictionary Dictionary length Merging Dictionaries Merging dictionaries with the same elements Deleting elements by key Extraction by key Extract the last element Delete all elements Presence of an element in a dictionary Optionally get element Convert to list Getting all the keys Getting all values Key-value pair Convert to dictionary Workshop

Sets

Introduction to Sets Element of a set Repeating elements in a set Length of the set Adding an element to a set Adding multiple elements to a set Union of sets Removing an element from a set Removing a present element Extracting an element Delete all elements Presence of an element in a set Presence of a set in a sequence Comparison of sets Common elements of sets Different elements of sets Difference of sets Complex operations Transformation into a set Workshop

Terms and Conditions

if-else construct Indents in conditions Operators greater than and less than Equality Test Testing for inequality Logical AND Logical OR Logical NO Precedence of comparison operations Grouping conditions Double comparisons Check availability Check for special values Abbreviated if elif construction Nested ifs match-case construction Ternary operator Checking the object type If else practice

Cycles

For loop Accumulating the result in a loop For loop and if condition break instruction Continue instruction Getting elements and their indices Dictionary keys via for Dictionary meanings Dictionary key-value pair Dictionary index-element pairs Number generation Generate numbers with a step Simultaneous enumeration The while loop While loop without counter If condition in while loop Working with flags Intercepting the exit from the loop Practice on cycles Entering data in a loop

Multidimensionality

Multidimensional lists 3D list Iterating over multidimensional lists Iterating over a three-dimensional list Iterating over a multidimensional list of dictionaries Populating multidimensional lists

Standard functions

Degrees Rounding functions Extremes Random Modules Mathematical operations with numbers Division of numbers Character case Line splits String formatting Search by strings Checking the string

Time

Working with dates Display current date Getting the day of the week The difference between two dates Definition of a Leap Year Time output Date formatting epoch format Output from epoch date struct object_time Getting a struct object_time by UTC Getting epoch format from struct_time Difference between eras Operation delay

User defined functions

Introduction Function parameters Return instruction Optional parameters Named parameters Variable parameters Nested functions Keyword pass Comments Feature Tips Practice on functions
enru