Reverse String in Python
Learn how to reverse a string in Python using slicing, reversed() with join(), for loop, and while loop. Understand why string[::-1] is the simplest method and avoid common mistakes.
Python subprocess: Run Shell Commands
Learn how to run shell commands in Python with subprocess.run(). Capture output, check return codes, handle errors, set timeouts, run multiple commands sequentially, and compare subprocess with os.system and os.popen.
Python pow() Function
Learn how Python pow() works with examples. Use pow(base, exp), the ** power operator, math.pow(), and pow(base, exp, mod) for modular exponentiation. Understand return types, negative powers, errors, and common …
Round Up in Python
Learn how to round up in Python using math.ceil(), decimal rounding, ceiling division, NumPy ceil(), and custom multiples. Understand why round() is not the same as rounding up and avoid common rounding mistakes.
Remove Element from List in Python
Learn how to remove elements from a Python list using remove(), pop(), del, clear(), and list comprehension. Remove by value, index, slice, condition, duplicate values, or all items with practical examples.
Write CSV in Python
Learn how to write CSV files in Python using the built-in csv module. See examples with csv.writer, writerow(), writerows(), headers, append mode, DictWriter, custom delimiters, newline handling, and pandas to_csv().
Python Reverse Range
Learn how to use Python range in reverse order. See examples with range(start, stop, -1), reversed(range()), reverse for loops, backward counting, custom steps, indexes, and common mistakes.
Python range()
Learn how Python range() works with examples. Use range() in for loops, understand start, stop, and step, create reverse ranges, convert range to list, use negative steps, and avoid common range mistakes.
Pylint
Learn what Pylint is and how to use it in Python. Install Pylint with pip, run it on files or projects, understand common messages, fix snake_case naming warnings, disable rules, and configure Pylint with pyproject.toml …
Python pwd Module
Learn how to use the Python pwd module on Unix/Linux systems. See examples for pwd.getpwnam(), pwd.getpwuid(), pwd.getpwall(), struct_passwd fields, current user lookup, Windows availability, and common errors.
Python Progress Bar
Learn how to create a progress bar in Python using print(), carriage return, sys.stdout.flush(), tqdm, progressbar2, and alive-progress. See examples for terminal loops, file processing, downloads, asyncio, and common …
Print Variable in Python
Learn how to print a variable in Python using print(), f-strings, commas, str.format(), and % formatting. See examples for printing strings, numbers, multiple variables, text with variables, and avoiding common TypeError …
Python sorted() Function
Learn how Python sorted() works with examples. Understand the difference between sort() and sorted(), sort lists, tuples, strings, dictionaries, use key functions, reverse=True, lambda, and custom sorting.
Python struct Module
Learn how to use the Python struct module to pack and unpack binary data. See examples for struct.pack(), struct.unpack(), struct.calcsize(), byte order, format strings, pack_into(), unpack_from(), and common errors.
Python try except
Learn how Python try except works with simple examples. See how to catch specific exceptions, handle multiple exceptions, use else and finally, raise exceptions, and avoid common mistakes.
Python input() Function
Learn how Python input() works, why it returns a string, how to convert input to int or float, handle non-numeric values, validate user input, take multiple inputs, and use input with asyncio.
Python UUID
Learn how to generate UUIDs in Python using the built-in uuid module. See examples of uuid4(), uuid1(), uuid3(), uuid5(), GUIDs, short UUIDs, UUID strings, hex values, and when to use each version.
Sort List in Reverse Alphabetical Order in Python
Learn how to sort a Python list in reverse alphabetical order using sort(reverse=True) and sorted(reverse=True). Also see how to solve the short_names exercise and choose between in-place sorting and creating a new list.
Python strip()
Learn how Python strip() works with examples. Remove leading and trailing whitespace, strip specific characters, compare strip(), lstrip(), and rstrip(), and avoid common mistakes with prefixes and suffixes.
Simple Linear Regression in Python
Learn simple linear regression in Python using pandas, scikit-learn, and matplotlib. Train a model, make predictions, evaluate accuracy, plot the regression line, and save predictions to a CSV file.
NumPy Shuffle Array
Learn how to shuffle a NumPy array using np.random.shuffle(), Generator.shuffle(), and permutation(). Also see how to shuffle two arrays or lists together in the same random order.
Seaborn Scatter Plot
Learn how to create a Seaborn scatter plot using sns.scatterplot(). See examples with hue, style, size, palette, marker size, transparency, labels, legends, and regression lines.
Remove Key from Dictionary in Python
Learn how to remove a key from a Python dictionary using pop(), del, dictionary comprehension, and safe methods to avoid KeyError when the key may not exist.
Python zip() Function
Learn how the Python zip() function works with lists, tuples, dictionaries, and loops. See how to handle different lengths with strict=True and zip_longest().
Sort Dictionary by Key in Python
Learn how to sort a dictionary by key in Python using sorted(), dict(), lambda, itemgetter(), reverse=True, case-insensitive sorting, and nested dictionary examples.
Python Substring
Learn how to get and check substrings in Python using slicing, the in operator, find(), index(), count(), and replace(). See extraction before or after a character and common mistakes.
Python super()
Learn how Python super() works with inheritance. See how to use super().__init__() in child classes, call parent methods, understand MRO, and avoid common multiple inheritance mistakes.
Python Symmetric Difference
Learn symmetric difference in Python using set.symmetric_difference() and the ^ operator. See examples, difference vs symmetric difference, multiple sets, lists, tuples, and common mistakes.
Python switch case
Learn how to write switch case logic in Python using match case, if-elif statements, and dictionary mapping. See Python switch statement examples, default cases, multiple cases, and when to use each approach.
Python Ternary Operator
Learn how the Python ternary operator works using value_if_true if condition else value_if_false. See simple examples, nested ternary expressions, list comprehension usage, and common mistakes.






