Articles by Bashir Alam
Java Type Casting Explained [Easy Examples]
The Java type casting is a method or process that converts a data type into another data type in both ways manually and automatically.
Python requests
Learn how to use Python requests for HTTPS GET and POST requests. Install requests with pip, check response.status_code, handle 200 responses, use raise_for_status(), set timeouts, and compare requests with urllib and …
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 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 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 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.
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.
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().
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.
Python Sort List
Learn how to sort a list in Python using list.sort() and sorted(). See examples for ascending order, descending order, strings, numbers, custom key functions, list of lists, tuples, dictionaries, None values, and common …
Python startswith()
Learn how Python startswith() works with simple examples. Check if a string starts with a prefix, use start and end positions, match multiple prefixes with a tuple, and perform case-insensitive startswith checks.
Python Static Method
Learn what a static method is in Python and how to use @staticmethod. See examples, static method vs class method vs instance method, when to use static methods, and common mistakes.
Python writelines() Method
Learn Python writelines() method with examples. Write a list of strings to a file, add newline characters, append lines, compare write() vs writelines(), and avoid common mistakes.
Python Optional Arguments
Learn how optional arguments work in Python functions, including default values, optional parameters, keyword arguments, *args, **kwargs, None defaults, and common mistakes.
Python Constructor: __init__ Method Explained
Learn Python constructors using the __init__ method with examples for self, parameters, default values, validation, copying mutable arguments, object creation, inheritance, dataclasses, __new__, and common constructor …
Python Operators
Learn Python operators with simple explanations, including arithmetic, comparison, assignment, compound assignment, logical, bitwise, membership, identity, and operator precedence.
Python None Keyword
Learn what None means in Python, how NoneType works, how to check if a value is None, and when to use None for missing values, function returns, and default arguments.
Python Multiline Comments
Learn how to write multiline comments in Python using multiple # comments. Understand why triple-quoted strings are not true comments, how docstrings differ from comments, and how to comment multiple lines in VS Code, …

