Home
Python programming language tutorial
Python Tutorial: Python is an object-oriented, high-level, interpreted programming language with dynamic semantics. Python has a rich set of high-level in-built data structures (data types) which combined with dynamic typing and data typing. It makes Python a very popular and attractive programming language for rapid application development, scripting.
Python is simple, easy to learn, readable and Python codes are smaller than codes of other programming languages like C, C++, Java, etc. The codes and relatively less and indented which makes the code readable/editable for the programmers all the time.
In this python tutorial, we covered almost all topics starting from python basics to advanced topics like Machine learning with Python, Python Pandas, Python Data Science, this Python tutorial is specifically designed for beginners and professionals.
Python Tutorial Topics
Python Overview
- Introduction to Python
- Why is python so popular?
- Virtual Environment for Python based application
- Install pip on MacOS or OSx
- Executing first program on Python in Different Modes
- What does if __name__ == '__main__': do in Python?
- What __init__ and self do in Python?
- Python | How to upgrade all Python packages with pip?
Python Basics
- Python Keywords
- Python built-in keywords with examples
- Python keywords Reference
- Comments in Python
- Block Comments in Python
- How do we create multiline comments in Python?
- How to read/process command line arguments in Python?
Python Data Types
- Variables and Data Types in Python
- Python Numeric Types
- How to determine a Python variable's type?
- Determine type of a variable
Python Input/Output
- Python print() function
- Input and Output Operations with Examples in Python
- Taking multiple inputs from the user using split() method in Python
- Fast input / output for competitive programming in Python
- Precision handling in Python
- Python print() function with end parameter
- sep parameter in Python with print() function
- file parameter in Python with print() function
- flush parameter in Python with print() function
- Print multiple variables in Python
- Asking the user for integer input in Python | Limit the user to input only integer value
- Asking the user for input until a valid response in Python
- Input a number in hexadecimal format in Python
- Input a number in octal format in Python
- Input a number in binary format in Python
Python Operators
- Python Arithmetic Operators
- Python Identity Operators
- Membership Operators in Python
- Behavior of increment and decrement operators in Python
- Logical and Bitwise NOT Operators on Boolean in Python
- Logical Operators on String in Python
- if else conditional operator in Python
Python Conditional Statements
- Conditional statements (if, if...else, if...elif...else, and nested if) in Python
- Conditional statements (if, break and continue statements) in Python
Python Control Statements
- Loops in Python
- Accessing the index in 'for' loops in Python
- Looping constructs in Python
- do while loop in Python
- Emulate a do-while loop in Python
- break statement in Python
- continue statement in Python
- Python pass statement
- else with for/while statement
- Replacements for switch statement in Python
- Generators in Python
- List Comprehension vs Generators Expression in Python
Python Functions
- Functions in Python
- Different ways to define and call user-defined functions
- Function classifications on the basis of parameters and return values
- Types of function calling with Examples
- Types of parameters
- Python default parameters
- Function as data type (Explain: First class, Closure)
- Lambda Expression/function in python
- Lambda function with Example
- Nested Lambda Function in Python
- Iterating with Python Lambda
- Lambda and map() with Example
- Lambda and filter() with Example
- Lambda and reduce() with Example
- Example of function as argument
- Example of function as return value
- Currying function with example in Python
- Multiple Function Arguments in Python
Python Strings
- Python Strings and its implementation
- String operators with examples in python
- Python string methods with Examples (Set-1)
- Python String Methods with Examples (Set-2)
- f-strings in Python 3 – Formatted string literals
- How to print to stderr in Python?
- How do you read from stdin in Python?
- Best way to convert string to bytes in Python3
- What exactly do 'u' and 'r' string flags do, and what are raw string literals in Python?
- Python string comparison
Python Modules
- How to check version of python modules?
- How to create Modules (Example of Modules)?
- Python datetime Module with Examples
- Python calendar Module with Examples
- Random Module with Examples in the Python
- Sys Module with Examples in Python
- Time Module with Example in Python
- pprint (Pretty Printer) in Python
- Reloading modules in Python
Python Lists
- Lists in python
- List Operations in Python - I
- List Operations in Python - II
- List Comprehension in Python
- append() and extend() in Python
- Difference between Python's list methods append() and extend()
- Accessing a list and its elements in Python
- Find the number of elements in a list in Python
Python Object Oriented
- Constructors with examples in Python
- Class or Static variables in Python
- Static methods in Python
- Metaclass in Python
- Difference between @staticmethod and @classmethod in Python
- Are static class variables possible in Python?
Python Exception Handling
- Exceptions handling in Python
- User-defined Exception in Python
- How to ignore Exceptions in Python?
- How do you test that a Python function throws an exception?
Python Libraries and Functions
- Python built-in functions
- Shallow Copy Vs Deep Copy in Python
- Python Math module methods
- Python OS & Shutil Modules Methods
Python Packages
- Python Packages | How to create and import them?
- How to create Packages (Example of Packages)?
Python Arrays
- Signed and Unsigned Integer Arrays in Python
- Common Data Items and Methods of an Array in Python
- Accessing elements from the array in Python
- Adding elements to an array in Python
- Convert an array to the list using array.tolist() in Python
- Preferred way to retrieve the length of an array in Python
-
Dask array
- Dask Array in Python
Python Numpy
- Numpy in Python
- Numpy Array Indexing in Python
- Numpy Array Operations in Python
Python Pandas
- Python for data analysis – Pandas
- Pandas DataFrame in Python
- Conditional selection in the DataFrame | Pandas DataFrame
- MultiIndex/Multi-level / Advance Indexing dataFrame | Pandas DataFrame
- Python Pandas – GroupBy
- Python Pandas – Merging, Joining and Concatenating
- Python Pandas – Missing Data
- Python Pandas – Data Input and Output
- Python Pandas – Operations
Python dictionary
- Dictionaries (Creation, Initialization, Access) in Python
- Dictionary Methods in Python
- Python OrderedDict
- Python Dictionary clear() Method with Example
- Python Dictionary copy() Method with Example
- Python Dictionary fromkeys() Method with Example
- Python Dictionary get() Method with Example
- Python Dictionary items() Method with Example
- Python Dictionary keys() Method with Example
- Python Dictionary pop() Method with Example
- Python Dictionary popitem() Method with Example
- Python Dictionary setdefault() Method with Example
- Python Dictionary update() Method with Example
- Python Dictionary values() Method with Example
- Python | Generate dictionary of numbers and their squares (i, i*i) from 1 to N
- Sorting a dictionary in Ascending and Descending order by Key or Value in Python
- Merge two dictionaries in a single expression in Python
- How do I sort a dictionary by value in Python?
- How to copy a dictionary and only edit the copy in Python?
Python set
- Sets in Python
- Python Set add() Method with Example
- Python Set clear() Method with Example
- Python Set copy() Method with Example
- Python Set difference() Method with Example
- Python Set difference_update() Method with Example
- Python Set discard() Method with Example
- Python Set intersection() Method with Example
- Python Set intersection_update() Method with Example
- Python Set isdisjoint() Method with Example
- Python Set issubset() Method with Example
- Python Set issuperset() Method with Example
- Python Set pop() Method with Example
- Python Set remove() Method with Example
- Python Set symmetric_difference() Method with Example
- Python Set symmetric_difference_update() Method with Example
- Python Set union() Method with Example
- Python Set update() Method with Example
Python Tuples
- Tuples in Python
- Reverse each tuple in a list of tuples in Python
- Creating tuple without using parenthesis in Python
- Creating a tuple with one element in Python
- Empty tuple creation in Python
- Clearing a tuple in Python
- Reinitializing a tuple in Python
- Python Tuple Exercises
Python number systems
- Python | Binary numbers representation (assign, conversion, bitwise operations)
- Python | Count total number of bits in a number
Python String Methods
- Python String | len() Method with Example
- Python String | count() Method with Example
- Python String | strip() Method | Remove leading and trailing spaces from string
- Python String | strip() Method | Remove leading and trailing characters from string
- Python String | isdecimal() Method with Example
- Python String | isnumeric() Method with Example
- Python String | isdigit() Method with Example
- Python | Difference between string isdecimal(), isdigit(), isnumeric() and Methods
- Python String | isalnum() and isalpha() Methods with Examples
- Python String | isupper() and islower() Methods with Examples
- Python String | join() Method with Example
- Python String | capitalize() Method with Example
- Python String | find() Method with Example
- Python String | format() Method with Example
- Python | string.upper(), string.lower() and string.title() Methods with Examples
- Python String | endswith() method with example
- Find all the indexes of all the occurrences of a word in a string in Python
- Why is it string.join(list) instead of list.join(string) in Python?
- Remove trailing new line in Python
- How do I check if a string is a number (float) in Python?
- Extracting extension from filename in Python
- Random string generation with upper case letters and digits in Python
- str() vs repr() functions in Python
- Python String formatting: % vs. .format
- What does the 'b' character do in front of a string literal in Python?
Python list methods
- Python List append() Method with Example
- Python List insert() Method with Example
- Python List clear() Method with Example
- Python List copy() Method with Example
- Python List count() Method with Example
- Python List index() Method with Example
- Python List extend() Method with Example
- Python List pop() Method with Example
- Python List remove() Method with Example
- Python List reverse() Method with Example
- Python List sort() Method with Example
- List append() vs insert() methods in Python
- Difference between del, remove and pop functions of a list in Python
- How to randomly select an item from a list in Python?
- How can I count the occurrences of a list item in Python?
- All Python list programs...
Python File methods
- Python File name Property with Example
- Python File mode Property with Example
- Python File encoding Property with Example
- Python File closed Property with Example
- Python File errors Property with Example
- Python File open() Method with Example
- Python File close() Method with Example
- Python File read() Method with Example
- Python File write() Method with Example
- Python File seek() Method with Example
- Python File flush() Method with Example
- Python File fileno() Method with Example
- Python File readable() Method with Example
- Python File writable() Method with Example
- Python File seekable() Method with Example
- Python File isatty() Method with Example
- Python File tell() Method with Example
- Python File readline() Method with Example
- Python File readlines() Method with Example
- Python File writelines() Method with Example
- Python File truncate() Method with Example
File handling in python
- File Handling in Python
- Opening, closing a file/open(), close() functions in Python
- Printing file name, closed status and file mode in Python
- Writing, Reading content of the file in Python
- How to write in an existing file in Python?
- Python | Check if a file exists or not?
- Python | Example of FileNotFoundError
- Python | print the file content along with the filename
- Python | Read file from given index (Example of tell() and seek())
- Python | Input data from the user, save to the file, read and print
- Python | Rename an existing file (Example of os.rename() method)
- Python | Remove an existing file (Example of os.remove() method)
- Importing files from different folder in Python
Python WebSocket
- What is WebSocket and how to use it in Python?
- Basic concepts of WebSocket server in Python
- How to implement a WebSocket server using Tornado?
- Implementation of WebSocket using Socket-IO in Python
- Implementation of WebSocket using Flask Socket IO in Python
- Websocket keep alive in Python
GUI programming using Python and PyQT
- GUI development using Python and PyQT
- Print ‘Hello World’ using Python and PyQT (first PyQT program)
- Print ‘Hello World’ using Python and PyQT -2 (Theory)
- Print ‘Hello World’ using Python and PyQT -2 (Practical)
- PyQt Event handling mechanism
- Event Handling Examples - PyQt
- Event Handling Examples (2)- PyQt
- Button Function and Custom Event – PyQt
- PyQt- Layout management - 1 (Drag and Drop with QtDesigner)
Python GUI programming using tkinter
- GUI programming in Python using tkinter Module
- Python | Text Area and Button in Tkinter
Python Image processing
- Drawing flag of Thailand | Image processing in Python
- Drawing of flag Sweden | Image processing in Python
- Drawing flag of Japan | Image processing in Python
- Coloured image to grayscale using OpenCV in Python
- Find complementary image of the RGB image in Python
- Show different planes of an RGB image in Python
- Resize a grayscale image without using any inbuilt functions in Python
- Resize an RGB image without using any inbuilt functions in Python
- Convert an RGB format Image in an HSV format Image using OpenCV in Python
- Rotate a grayscale image by 180 degree without using any inbuilt function in Python
- Smoothen a grayscale image by performing blurring operation using user defined median blur filter
- Smoothen the image by performing blurring operation on a grayscale image using user defined mean blur filter in Python
- Upscaling the grayscale image in Python
- Upscaling the RGB image in Python
- Read an image and save it as grayscale system using OpenCV python module
- Edge Detection of Image using OpenCV (CV2) in Python
- Cropping an Image using OpenCV in Python
- How to Generate and Read QR Code using Python and OpenCV?
- Capturing mouse click events with Python and OpenCV
- Face and Eye Detection in Python using OpenCV
- Create a Collage of Images with the help of NumPy and Python-OpenCV(CV2)
Python Flask
- Introduction to Web development using Flask
- For loop in Flask template engine
Python Working with Excel
Python Misc. Topics
- Matrix implementation in Python
- Matrix Multiplication in Python
- Descriptors in Python
- How to call an external command in Python?
- Slice Notation in Python
- Understanding slice notation with examples in Python
- 5 Best Python Web Scraping Libraries
- How do I parse an ISO 8601-formatted date in Python?
- What is the quickest way to HTTP GET in Python?
- timeit() Function with Example in Python
- Optimization using Greedy Algorithm in Python
- Python | Linear Algebra
- Python | Data Visualization
- Perceptron algorithm and its implementation in Python
- Scraping Links from a Webpage in Python
- Text to speech model in Python
- Alarm clock in Python with the help of datetime and pyttsx3
- Sending Emails using SMTP in Python
- Getting old tweets using Getoldtweets3 module in Python
- Automating pdfs in Python
- Rock Paper Scissors Game in Python
- How to download YouTube videos in Python?
Python Keywords
Python built-in Functions
Exercise of built-in functions
Python Math module methods
Python Math module constants
Python OS & Shutil Modules Methods
Python operator Module Methods
Python re Module Methods
Python keyword Module Methods
Python pyperclip Module Methods
Python Topic-wise MCQs
Find output of programs
- Find output of Python programs -| Set 1 (Mixed topics)
- Find output of Python Programs | Set 1 (Basics)
- Find Output of Python programs | Set 2 (Basics)
Python Competitive Coding Questions
- Python Arithmetic Sequences | Competitive Coding Questions
- Python Power Challenge | Competitive Coding Questions
- Python XOR and Arrays | Competitive Coding Questions
- All Python competitive coding questions
Python programs
Showing latest posts on the top...