Browse by category
Clean, runnable snippets in Python, C, and PHP, organized by topic. Filter by language or level, then load any example straight into the Playground.
34 categories
Basics
Learn Python fundamentals: variables, print statements, data types, arithmetic operations, and type conversion for beginners.
Loops
Master Python loops: for loops, while loops, range function, break and continue statements with practical examples.
Functions
Learn Python functions: define functions, function arguments, return statements, lambda functions, and recursion with examples.
Lists
Python lists tutorial: create lists, indexing, slicing, list methods, list comprehension, sorting, and filtering data.
Strings
Master Python strings: string methods, slicing, formatting with f-strings, searching, and string manipulation techniques.
Dictionaries
Python dictionaries guide: create dictionaries, key-value pairs, access values, iteration, dictionary comprehension, and manipulation.
OOP
Object-oriented programming in Python: classes, inheritance, encapsulation, special methods, static and class methods.
Tuples & Sets
Python tuples and sets: immutable sequences, set operations, unpacking, removing duplicates, and collection techniques.
Files & Errors
Python file handling and error handling: read/write files, try-except-finally, exception handling, and error management.
Conditionals
Python conditional statements: if, elif, else, ternary expressions, comparison operators, and the match statement for control flow.
Comprehensions
Python comprehensions: list, dictionary, set, and generator expressions for concise and readable data transformation.
Lambda & Functional
Functional programming in Python: lambda functions, map, filter, reduce, and sorted with custom keys for clean data processing.
Enumerate & Zip
Python enumerate and zip functions: loop with indexes, pair multiple iterables, and build dictionaries from parallel lists.
Decorators
Python decorators explained: wrap functions, add behavior, build decorators with arguments, and preserve metadata with functools.wraps.
Generators
Python generators and iterators: yield values lazily, build memory-efficient sequences, and use next to control iteration.
Modules & Imports
Python modules and imports: import standard library modules, use from imports, create aliases, and work with math and random.
Collections Module
Python collections module: Counter, defaultdict, namedtuple, and deque for powerful and efficient data structures.
Regular Expressions
Python regular expressions with the re module: search, findall, sub, and split to match and transform text patterns.
Dates & Times
Python datetime module: create dates, format with strftime, add timedeltas, parse strings, and calculate differences between dates.
JSON Data
Work with JSON in Python: parse strings with json.loads, serialize with json.dumps, format output, and access nested data.
Type Hints
Python type hints and annotations: annotate function parameters, return types, variables, and use Optional and typing generics.
Recursion
Recursion in Python: solve problems by calling a function within itself, with factorial, Fibonacci, list sums, and power examples.
Context Managers
Python context managers and the with statement: manage resources safely, build custom managers, and use contextlib decorators.
Itertools
Python itertools module: count, cycle, islice, chain, combinations, and permutations for efficient iterator building blocks.
C Basics
Learn C fundamentals: printf output, variables, data types, arithmetic operators, and constants for absolute beginners.
C Control Flow
Master control flow in C: if and else statements, the switch statement, for loops, and while loops with clear examples.
C Functions
Write functions in C: define and call functions, return values, recursion, and passing arguments by reference with pointers.
C Arrays & Strings
Work with arrays and strings in C: declare arrays, loop over elements, measure string length, and compare strings with string.h.
C Pointers
Understand pointers in C: read a value through a pointer, modify memory by reference, and swap two variables using pointers.
PHP Basics
Learn PHP fundamentals: echo output, variables, data types, arithmetic, and string interpolation for beginners.
PHP Strings
Master PHP string functions: measure length, change case, concatenate, replace, find, split, and join text.
PHP Arrays
Work with PHP arrays: indexed arrays, associative arrays, looping with foreach, and helpful array functions like sort and array_sum.
PHP Control Flow
Control program flow in PHP: if, elseif, and else, for loops, while loops, and the modern match expression.
PHP Functions
Define functions in PHP: parameters and return values, default arguments, arrow functions, and recursion with examples.