Sri

Sri

9 Articles Published

Articles by Sri

9 articles

What are the tools that help to find bugs or perform static analysis in Python?

Sri
Sri
Updated on 25-Mar-2026 2K+ Views

Python offers several static analysis tools to help developers find bugs, enforce coding standards, and improve code quality. The most popular tools are Pylint, Flake8, and PyChecker, each with unique features for code analysis. Pylint Pylint is a highly configurable static code analysis tool that checks for programming errors, enforces coding standards, and provides detailed reports on code quality ? Features Detects programming errors and potential bugs Enforces PEP 8 coding standards Checks variable naming conventions Measures code complexity and line length Integrates with IDEs like PyCharm, VS Code, and Eclipse Installation ...

Read More

What is lambda binding in Python?

Sri
Sri
Updated on 25-Mar-2026 807 Views

Lambda binding in Python refers to how variables are captured and bound when creating lambda functions. Understanding this concept is crucial for avoiding common pitfalls when working with closures and lambda expressions. What is Lambda Binding? When a lambda function is created, it captures variables from its surrounding scope. However, the binding behavior depends on when and how the variable is referenced ? def create_functions(): functions = [] for i in range(3): functions.append(lambda: i) # Late binding ...

Read More

Is Python Object Oriented or Procedural?

Sri
Sri
Updated on 25-Mar-2026 5K+ Views

Python is a multi-paradigm programming language that supports both Object-Oriented Programming (OOP) and Procedural Programming. As a high-level, general-purpose language, Python allows developers to choose the programming style that best fits their needs. You can write programs that are largely procedural, object-oriented, or even functional in Python. The flexibility to switch between paradigms makes Python suitable for various applications, from simple scripts to complex enterprise systems. Object-Oriented Programming in Python Python supports all core OOP concepts including classes, objects, encapsulation, inheritance, and polymorphism. Here's an example demonstrating OOP principles ‒ class Rectangle: ...

Read More

How To Do Math With Lists in python ?

Sri
Sri
Updated on 25-Mar-2026 10K+ Views

Lists in Python can be used for various mathematical operations beyond just storing values. Whether calculating weighted averages, performing trigonometric functions, or applying mathematical operations to collections of data, Python's math module combined with list operations provides powerful computational capabilities. Basic Math Operations with Single Values The math module provides functions for common mathematical operations ? import math data = 21.6 print('The floor of 21.6 is:', math.floor(data)) print('The ceiling of 21.6 is:', math.ceil(data)) print('The factorial of 5 is:', math.factorial(5)) The floor of 21.6 is: 21 The ceiling of 21.6 is: 22 The ...

Read More

What is the difference between del, remove and pop on lists in python ?

Sri
Sri
Updated on 25-Mar-2026 641 Views

When working with Python lists, you have three main methods to remove elements: remove(), del, and pop(). Each method serves different purposes and behaves differently depending on your needs. Using remove() The remove() method removes the first matching value from the list, not by index but by the actual value ? numbers = [10, 20, 30, 40] numbers.remove(30) print(numbers) [10, 20, 40] If the value doesn't exist, remove() raises a ValueError ? numbers = [10, 20, 30, 40] try: numbers.remove(50) # Value not in ...

Read More

How are arguments passed by value or by reference in Python?

Sri
Sri
Updated on 25-Mar-2026 14K+ Views

Python uses a mechanism known as Call-by-Object, sometimes also called Call by Object Reference or Call by Sharing. Understanding how arguments are passed is crucial for writing predictable Python code. If you pass immutable arguments like integers, strings or tuples to a function, the passing acts like Call-by-value. It's different when we pass mutable arguments like lists or dictionaries. Immutable Objects (Call-by-value behavior) With immutable objects, changes inside the function don't affect the original variable ? def modify_number(x): x = 100 print("Inside function:", x) num = ...

Read More

Difference between mutable and immutable in python?

Sri
Sri
Updated on 25-Mar-2026 3K+ Views

Python defines variety of data types of objects. These objects are stored in memory and object mutability depends upon the type. Mutable objects like Lists and Dictionaries can change their content without changing their identity. Immutable objects like Integers, Floats, Strings, and Tuples cannot be modified after creation. Mutable Objects - Lists Lists are ordered collections that can be modified after creation. You can change individual elements, add new items, or remove existing ones ? # Creating a list of numbers numbers = [1, 2, 3, 4, 5] print("Original list:", numbers) # Modifying an element ...

Read More

What is the difference between .py and .pyc files ?

Sri
Sri
Updated on 11-Mar-2026 3K+ Views

Python compliles the .py files and save it as .pyc fileThe .pyc contain the compiled bytecode of Python source files, A .pyc is not created for your main program file that you execute (only for imported modules).The .pyc file contains encoded python bytecode.If We Want to import module.The Module calculate Addition of Two NumbersExampledef recursive_sum(n): """Function to return the sum of recursive numbers""" if n

Read More

What is itermonthdates() in python?

Sri
Sri
Updated on 30-Jul-2019 338 Views

itermonthdates() method will return all days for the month and all days before the start of the month or after an end of the month that are required to get a complete week.Exampleimport calendar #assigning variable to the calendar variable = calendar.Calendar() for day in variable.itermonthdates(2019, 5): print(day)Output2019-04-29 2019-04-30 2019-05-01 2019-05-02 2019-05-03 2019-05-04 2019-05-05 2019-05-06 2019-05-07 2019-05-08 2019-05-09 2019-05-10 2019-05-11 2019-05-12 2019-05-13 2019-05-14 2019-05-15 2019-05-16 2019-05-17 2019-05-18 2019-05-19 2019-05-20 2019-05-21 2019-05-22 2019-05-23 2019-05-24 2019-05-25 2019-05-26 2019-05-27 2019-05-28 2019-05-29 2019-05-30 2019-05-31 2019-06-01 2019-06-02Important to rememberlook into the output that calendar shows starts the previous month's date and ends with the after ...

Read More
Showing 1–9 of 9 articles
« Prev 1 Next »
Advertisements