This series of Python Tutorials help you get started with the basics of Python programming. Also, we will look into most used Python Libraries with thorough examples.
Welcome to Python Tutorial by TutorialKart!
There is nothing you need to know in prior. If you are interested in learning Python programming from scratch, we have a well built and organised set of tutorials to help you master Python.
The following tutorials cover basics of any programming language like variables, datatypes, comments, conditional statements, looping statements, functions, etc.
- Syntax Introduction to the syntax of Python programming. Indentation, identifiers, etc.
- Variables Variables are storage locations to store given value. Learn how to define a variable, and how to store a value in the variable.
- Comments Learn how to write comments in a Python program. Single-line comments, Double-line comments.
- Numbers Types of numbers in Python: int, float. Learn how to define int or float, and perform different operations on them.
- Booleans Booleans are used to hold the state of either True or False. Learn how to define a boolean, use them in statements, etc.
- Strings String is a sequence of characters. Learn how to define a string, multiline string, and different String methods.
- Keywords Keywords are the reserved words in Python programming. Each of them have a specific meaning and purpose.
- Constants Constants are used to store read only values (values that cannot be changes). Even though Python does not have builtin type of Constants, this tutorial presents a workaround.
- Datatype Conversion Convert a value in variable from one datatype to another.
- Underscores in Numbers Underscores in numbers are used to improve the readability of numbers when the numbers are relatively large.
- Arithmetic Operators Python Tutorial about Addition, Subtraction, Multiplication, Division, Modular Division, Floor Division, and Exponentiation Operators.
- Bitwise Operators Python Tutorial about bitwise AND, bitwise OR, bitwise XOR, bitwise NOT, bitwise Zero fill left shift, bitwise Signed right shift operators.
- Assignment Operators Python Tutorial about Assignment, Addition Assignment, Subtraction Assignment, Multiplication Assignment, Division Assignment, Modulus Assignment, Exponentiation Assignment, Floor-division Assignment, AND Assignment, OR Assignment, XOR Assignment, Zero fill left shift Assignment, and Signed right shift Assignment Operators.
- Comparison Operators Python Tutorial about Equal-to, Not-Equal-to, Greater-than, Less-than, Greater-than or Equal-to, Less-than or Equal to Operators.
- Identity Operators Python Tutorial about IS, and IS NOT identity operators.
- Logical Operators Python Tutorial about logical AND, logical OR, and logical NOT operators.
- Membership Operators Python Tutorial about IN and NOT IN membership operators.
Conditional Statements are used to execute a block of statements based on the result of a condition.
- If Statement Learn the syntax and usage of basic conditional if statement in Python.
- If-Else Statement Learn the syntax and usage of conditional statement with if and else blocks.
- Elif Statement Learn the syntax and usage of if-elif-else ladder conditional statement.
- Ternary Operator Ternary Operator is used to select one of the two values based on a condition. Code using Ternary Operator is concise over if-else for this use case.
Looping statements are used to execute a block of statements repeatedly for N number of times, or for each item/element in a sequence/collection. Looping control statements like
continue, control the execution flow of a loop, like breaking the loop, or continuing with the next iteration, respectively.
- While Loop Execute a block of code as long as the condition is True.
- Infinite While Loop While Loop with condition always True, so that the While Loop runs indefinitely.
- Nested While Loop While Loop inside a While Loop.
- While Loop with Break While Loop with a break statement inside it. break statement can break the while loop even before the condition becomes False.
- While Loop with Continue While Loop with a continue statement inside it. continue statement can skip the execution of further statements inside while loop for the current iteration.
- For Loop The syntax of a basic For Loop in Python, and examples.
- For Loop with Index This tutorial shows how to get the index of the element when looping over an iterator using a For Loop.
- For Loop with Range This tutorial shows how to use a For Loop with a Range object.
- For Loop with Increment in Steps Iterate through an iterable in steps by skipping some elements in between, using For Loop.
- Break Statement It is used to break a loop statement (For Loop / While Loop) prematurely.
- Continue Statement It is used to skip the execution of further statements in a loop, for the current iteration, and continue with the next iteration.
Python Sequences are objects whose elements are ordered and could be accessed using index. The following tutorials cover different sequences in Python programming language.
- Lists Python Tutorial with an introduction to lists, syntax to create lists, examples, etc.
- List Methods Python list class provides many methods that transform or operate on the items of the List. This tutorial provides all the methods of a List class, and examples for each of the methods.
- List Programs Python programs that cover different use-cases related to lists.
- Dictionary Python Tutorial with an introduction to dictionaries, syntax to create dictionaries, examples, etc.
- Dictionary Methods Python Tutorials explained in detail about the methods available in dict class.
- Dictionary Programs Python programs that cover different use-cases related to dictionaries.
- Sets Python Tutorial with an introduction to sets, syntax to create sets, examples, etc.
- Set Methods Python Tutorials explained in detail about the methods available in set class.
- Set Programs Python programs that cover different use-cases related to sets.
Strings are sequences of characters. The following tutorials deal with String methods, checks on strings, transformations on strings, String properties, etc.
A function is a logical piece where a block of code (set of statements) is given a name. We can execute this function by the name, pass some parameters to this function to transform them, and return a value if required.
Python offers some functions that are built in to Python core, and also offers syntax to write our own functions.
- Functions Learn how to write a function in Python. Functions can take arguments, can return a value, can be passed as arguments to other functions, etc.
- Builtin Functions Python provides several builtin function for the most trivial functionalities. This tutorial presents all the builtin functions available in Python, and tutorials for each of them.
- Lambda Functions Lambda Functions are anonymous functions. This Python Tutorial presents the syntax, and how to use Lambda Functions. *
We can convert values from one datatype to another using builtin functions or type conversion.
The following tutorials cover some of the basic type conversions from one datatype to another.
- Length of Bytes Tutorial to get length of bytes present in the given bytes object.
Python Ranges are a series of numbers defined by a start (default=0) element, end element, and an optional difference between the adjacent elements.
The following tutorials will get you started with Python Ranges, how to create them, how to traverse them, etc.,
- range() Tutorial that covers Python range() builtin function.
- Range with Floating Point Numbers Python Tutorial to define a Range object that yields floating point numbers when iterated.
- Range in Reverse or Negative Steps Python Tutorial to define a Range object that starts at a given number and decrements in steps.
- Find Length of Range Python Tutorial to get the length of a Range object, or the number of elements in a given Range.
- Convert Range to List Python Tutorial to convert given Range object into a List of elements.
- Check if Specified Number is in Range Python Tutorial to check if a specific number is present in the given Range object.
Set is an unordered collection of items.
The following tutorials cover how to create a Set, how to iterate over the elements, find an element in a Set, etc.
The following tutorials cover basic CRUD file operations: Create, Read, Update and Delete.
- Create new Text File
- Read File as String in Python Python Tutorial to read the file content at given location, to a String.
- Write String to Text File in Python Python Tutorial to write given string to a text file at given location.
- Delete File in Python Python Tutorial to delete a file at specific path.
- Check if File Exists Python Tutorial to check if file defined by given path is present or not using
- Check if Directory Exists
- Get the list of all files in a directory
- Loop through files in directory
- Overwrite Existing Text File
- Loop through lines in Text File
Input / Output Operations
We can read input from user via standard input console, and write output to standard output console.
- Read Input from Command Line Python Tutorial to use input() builtin function to read input string from user via command line.
- Read Integer from Command Line Python Tutorial to use input() and int() builtin functions to read integer as input from user via command line.
- Read Float from Command Line Python Tutorial to use input() and float() builtin functions to read floating-point number as input from user via command line.
- Read a List from Command Line Python Tutorial to read a list of elements from user via command prompt or console.
JSON is the most used data format used to transfer information between applications.
- JSON Tutorial Introduction to working with JSON files or JSON strings in Python.
The following tutorials cover DateTime library methods to work with date and time in Python programming.
- Python DateTime Format Python Tutorial to work with Date and Time objects.
In Python, pandas is a library used for data manipulation and analysis. Pandas library offers data structures and operations for manipulating numerical tables and time series.
- Pandas Tutorial Pandas is an open source data analysis tool. This tutorial is an introduction to Pandas library.
MongoDB is a database in which documents are stored in JSON form.
The following tutorials will get you started with working on MongoDB from Python programs.
- Connect to MongoDB from Python Python Tutorial to connect to a MongoDB instance from Python program.
The following tutorials cover OpenCV Python API for Image Processing.
- Python – OpenCV Tutorial Python Tutorial to learn how to use OpenCV Python API for Image Processing.
- Python unittest Tutorial unittest is used to write unit test cases for testing. This tutorial gives an introduction to unittest library.
The following are the commonly used use cases for learning and to master Python programming.
The following are the most usually asked Interview Questions with well explained answers and programs.
- Python Interview Questions A list of commonly asked questions, and their answers, in an interview requiring Python programming skillset.
In this Python Tutorial, we have learned the basics of Python programming, some of the most used builtin functions, python modules, how to work with file system, string operations, and many advanced concepts.