Home
Python Tutorial
Last updated : December 07, 2024
What is Python?
Python is an object-oriented, high-level, interpreted programming language with dynamic semantics. It has a rich set of high-level in-built data structures (data types) which are combined with dynamic typing and data typing. It makes Python a very popular and attractive programming language for rapid application development, and scripting. It is simple, easy to learn, and readable and Python's codes are smaller than codes of other programming languages like C, C++, Java, etc. The codes and relatively less indented which make the code readable/editable for the programmers all the time.
The Python Tutorial
In this Python tutorial, we covered almost all topics starting from basics to advanced topics like Machine learning with Python, Python Pandas, and Python Data Science, this Python tutorial is specifically designed for beginners and professionals.
Python Tutorial Topics
Python Overview
- Python - Introduction
- Python - Why Popular?
- Python - Virtual Environment
- Python - Install pip on MacOS
- Python - First Program Modes
- Python - if __name__ == '__main__'
- Python - __init__ and self
- Python - Upgrade Packages
Python Basics
- Python - Keywords
- Python - Built-in Functions
- Python - Comments
- Python - Block Comments
- Python - Multiline Comments
- Python - Command Line Args
Python Data Types
- Python - Variables
- Python - Data Types
- Python - Numeric Types
- Python - Determine Variable Type
- Python - type() Method
Python Input/Output
- Python - print() Function
- Python - I/O Operations
- Python - Multiple Inputs with split()
- Python - Fast I/O for Competitive Programming
- Python - Precision Handling
- Python - print() with end
- Python - sep in print()
- Python - file in print()
- Python - flush in print()
- Python - Print Multiple Variables
- Python - Ask for Integer Input
- Python - Ask for Valid Input
- Python - Input Hexadecimal Number
- Python - Input Octal Number
- Python - Input Binary Number
- Python - Read Input as Integer
- Python - Read Input as Float
- Python - Parse String to Float
Python Operators
- Python - Arithmetic Operators
- Python - Identity Operators
- Python - Membership Operators
- Python - Increment/Decrement Behavior
- Python - NOT Operators on Boolean
- Python - Logical Operators on String
- Python - if-else Conditional Operator
Python Conditional Statements
- Python - Conditional Statements
- Python - Conditional with break/continue
Python Control Statements
- Python - Loops
- Python - Access Index in for Loop
- Python - Looping Constructs
- Python - do-while Loop
- Python - break Statement
- Python - continue Statement
- Python - pass Statement
- Python - else with Loops
- Python - switch Statement Alternative
Python Functions
- Python - Functions Overview
- Python - Define/Call User Functions
- Python - Function Classifications
- Python - Function Calls
- Python - Function Parameters
- Python - Default Parameters
- Python - Function as Data Type
- Python - Lambda Function
- Python - Nested Lambda
- Python - Iterating with Lambda
- Python - map() with Lambda
- Python - filter() with Lambda
- Python - reduce() with Lambda
- Python - Function as Argument
- Python - Function as Return
- Python - Currying
- Python - Multiple Arguments
Python Strings
- Python - Strings
- Python - String Operators
- Python - String Methods
- Python - f-strings
- Python - Print to stderr
- Python - Read from stdin
- Python - String to Bytes
- Python - 'u' and 'r' Flags
- Python - String Comparison
- Python String Methods Reference
- Python - String formatting: % vs .format()
- Python - 'b' character in string literals
- Python - Find all indexes of word occurrences
- Python - Why use string.join(list)?
- Python - Remove trailing new line
- Python - Check if a string is a number (float)
- Python - Extract extension from filename
- Python - Random string with uppercase and digits
Python Modules
- Python - Check Module Version
- Python - Create/Import Modules
- Python - datetime Module
- Python - calendar Module
- Python - random Module
- Python - sys Module
- Python - time Module
- Python - pprint Module
- Python - Reload Modules
Python Lists
- Python - Lists Tutorial
- Python - List Comprehension
- Python - List Methods
Python Object Oriented Concepts
- Python - Constructors
- Python - Class/Static Variables
- Python - Static Methods
- Python - Metaclasses
- Python - @classmethod vs @staticmethod
Python Arrays
- Python - Signed & Unsigned Integer Arrays
- Python - Array Data Items & Methods
- Python - Accessing Array Elements
- Python - Adding Elements to Array
- Python - Convert Array to List
- Python - Retrieve Array Length
- Python - Dask Array
Python Dictionary
- Python - Dictionaries
- Python - Useful Dictionary Methods
- Python - OrderedDict
- Python - Dictionary Methods Reference
- Python - Generate Dictionary of Squares
- Python - Sort Dictionary by Key/Value
- Python - Merge Two Dictionaries
- Python - Sort Dictionary by Value
- Python - Copy Dictionary and Edit Copy
Python Set
- Python - Sets
- Python - Set Methods
Python Tuples
- Python - Tuples
- Python - Reverse Tuples in List
- Python - Create Tuple Without Parentheses
- Python - Create Tuple with One Element
- Python - Create Empty Tuple
- Python - Clear Tuple
- Python - Reinitialize Tuple
- Python - Tuple Exercises
Python Exception Handling
- Python - Exception Handling
- Python - User-defined Exception
- Python - Ignore Exceptions
- Python - Test Function for Exception
Python Numpy
- Python - NumPy
- Python - NumPy Array Indexing
- Python - NumPy Array Operations
Python Pandas
- Python - Data Analysis with Pandas
- Python - Pandas DataFrame
- Python - Conditional Selection in Pandas
- Python - MultiIndex in Pandas
- Python - Pandas GroupBy
- Python - Merging, Joining, Concatenating in Pandas
- Python - Pandas Missing Data
- Python - Pandas Data Input/Output
- Python - Pandas Data Operations
Python File Handling
- Python - File Handling
- Python - open() & close() Functions
- Python - File Name, Closed Status, Mode
- Python - Writing & Reading Files
- Python - Write in Existing File
- Python - Check if File Exists
- Python - FileNotFoundError Example
- Python - Print File Content & Name
- Python - Read File from Index
- Python - User Input, Save & Print
- Python - Rename File with os.rename()
- Python - Remove File with os.remove()
- Python - Import Files from Other Folders
- Python - File Methods
Python WebSocket
- Python - WebSocket Overview
- Python - WebSocket Server Concepts
- Python - WebSocket Server with Tornado
- Python - WebSocket with Socket-IO
- Python - WebSocket with Flask Socket-IO
- Python - WebSocket Keep Alive
Python GUI Programming
- Python - GUI with PyQt
- Python - Hello World with PyQt
- Python - Hello World with PyQt (Theory)
- Python - Hello World with PyQt (Practical)
- Python - PyQt Event Handling
- Python - PyQt Event Handling Examples
- Python - More PyQt Event Handling Examples
- Python - Button and Custom Event in PyQt
- Python - PyQt Layout Management (Drag and Drop)
- Python - GUI with Tkinter
- Python - Text Area and Button in Tkinter
Python Image Processing
- Python - Drawing Thailand Flag
- Python - Drawing Sweden Flag
- Python - Drawing Japan Flag
- Python - Convert Color Image to Grayscale
- Python - Find Complementary Image of RGB
- Python - Show RGB Image Planes
- Python - Resize Grayscale Image Without Inbuilt Functions
- Python - Resize RGB Image Without Inbuilt Functions
- Python - Convert RGB to HSV with OpenCV
- Python - Rotate Grayscale Image by 180° Without Functions
- Python - Smooth Grayscale Image with Median Blur
- Python - Smooth Grayscale Image with Mean Blur
- Python - Upscale Grayscale Image
- Python - Upscale RGB Image
- Python - Read and Save Image as Grayscale
- Python - Edge Detection
- Python - Crop Image
- Python - Generate and Read QR Code
- Python - Capture Mouse Clicks
- Python - Face and Eye Detection
- Python - Create Image Collage
Python Topic-wise MCQs
Python Practice
- Python Find Output Programs (Mixed topics)
- Python Find Output Programs (Basics - Set 1)
- Python Find Output Programs (Basics - Set 2)
- Python Competitive Coding Questions
Python Miscellaneous
- Python Math Module
- Python Operator Module
- Python - OS Module
- Python - Creating Directories & Handling Exceptions
- Python - Copy & Replace Files
- Python - Copy & Rename Files
- Python - Copy Files Between Directories
- Python - Check if File Exists
- Python - Copy Data Between Files
- Python - Create Nested Directory
- Python - List Files in Directory
- Python - Get Current Working Directory
- Python - Copy Data Between Excel Files
- Python - Shallow vs Deep Copy
- Python - Creating and Importing Packages
- Python - Creating Packages (Example)
- Python - Intro to Web Development with Flask
- Python - For Loop in Flask Templates
- Python - Matrix Implementation
- Python - Matrix Multiplication
- Python - Descriptors
- Python - Call External Command
- Python - Slice Notation
- Python - Understanding Slice Notation
- Python - 5 Best Web Scraping Libraries
- Python - Parse ISO 8601 Date
- Python - Quickest HTTP GET
- Python - timeit() Function Example
- Python - Greedy Algorithm Optimization
- Python - Linear Algebra
- Python - Data Visualization
- Python - Perceptron Algorithm
- Python - Scrape Links from Webpage
- Python - Text to Speech Model
- Python - Alarm Clock with Datetime & pyttsx3
- Python - Sending Emails with SMTP
- Python - Get Old Tweets with Getoldtweets3
- Python - Automating PDFs
- Python - Rock Paper Scissors Game
- Python - Download YouTube Videos
- Python - Binary Numbers Representation
- Python - Install Tkinter
- Python - Generators
- Python - List Comprehension vs Generators
Exercise of built-in functions