What is Recursion? In computer science, recursion is a strong programming technique that is used in many algorithms and data structures. In the context of data structures and algorithms, recursion refers to a function calling itself to solve a problem or conduct a computation, either directly or indirectly. Working & usage of Recursion in DSA: […]
May 13, 2023 | Data Structure | No comments
Because Python lacks a main() function, when the command to run a Python program is given to the interpreter, the code at level 0 indentation is executed. However, it will first define a few special variables. One such special variable is __name__. If the source file is run as the main program, the interpreter assigns […]
January 11, 2023 | python | No comments
The Thread class in Python’s threading module is used to create and manage threads. We can extend this class to create a Thread or create a Thread class object directly and pass a member function from another class. There are two methods for creating the Thread object and specifying the activity to be carried out: […]
December 31, 2022 | python | No comments
Python threading, as we saw in the previous tutorial, allows us to run different parts of our program concurrently, which can simplify our design. Functions of threading Module: Following are some of the Functions: Function Description active_count() Return the number of active Thread objects. The count returned is the same as the length of the list […]
December 30, 2022 | python | No comments
What is a Constructor? A constructor is a special method (function) used to initialize the class’s instance members. The main goal of constructors is to assign values to the class’s data members when an object of the class is created. Constructors are always called when an object is created, and the init() method simulates this. It […]
December 9, 2022 | python | No comments
A function is a collection of statements that accept input, perform some specific computation, and return output. The idea is to combine some frequently or repeatedly performed tasks into a function so that instead of writing the same code for different inputs, we can call the function. All functions written by the user fall into […]
December 6, 2022 | python | No comments
Table of Python String Methods. Function Name Description capitalize() The string’s first character is changed to an uppercase (capital) letter. casefold() Implements caseless string matching center() Add the requested character to the string as padding. count() Returns the number of occurrences of a substring in the string. encode() Encodes strings with the specified encoding scheme […]
November 24, 2022 | python | No comments
Two built-in functions in Python are used to perform input and output operations (OI Operations). The two built-in functions for performing output and input operations are listed below. print() – This function is used to output data. input() – This function is used to perform input operations. Take Input from the User: To perform input […]
November 20, 2022 | python | No comments
Java constructors or constructors in Java are terminologies used to construct something in our programs. A constructor in Java is a special method that is used to initialize objects. The constructor is called when an object of a class is created. It can be used to set initial values for object attributes. At least one constructor is called […]
May 13, 2022 | Java | No comments
A method is a block of code, a group of statements, or a set of code that performs a specific task or operation. These are also known as functions in other programming languages. The method describes the behavior of an object. It increases code reusability. It also provides an easy modification of the code. Method Declaration: […]
May 12, 2022 | Java | No comments