Found 26504 Articles for Server Side Programming

Python Program to Clear the String Buffer

Rohan Singh
Updated on 17-Apr-2023 10:12:53

4K+ Views

In Python, we can clear the string buffer by assigning an empty string to the buffer and using Python's inbuilt reset() method. A string buffer is a mutable sequence of characters. These characters can be modified according to the requirements. The string buffer can be modified or cleared before the string is written to an output stream. In this article, we will understand how to clear the string buffer using examples. Method 1 : Assign Empty String to the Buffer One of the methods to clear the string buffer is to assign the buffer with an empty string. Assigning an ... Read More

Python Program to Check if a string is a valid shuffle of two distinct strings

Rohan Singh
Updated on 17-Apr-2023 10:11:07

533 Views

In Python, we can use inbuilt functions like len() and logic to check the sequence of the characters in the resultant string to know if a string is a valid shuffle of two distinct strings. A valid shuffle of two distinct strings means that a string is formed by mixing the characters of two distinct strings while maintaining the order of the characters of the two original strings. Python provides various inbuilt functions to play with strings. In this article, we will check if the string formed by shuffling the characters of two distinct strings is a valid string or ... Read More

Difference between 'and' and '&' in Python

Rohan Singh
Updated on 17-Apr-2023 10:06:17

5K+ Views

In Python ‘and’ and ‘&’ both are used to perform logical operations. The and-operator is used to perform logical AND operation whereas the & operator is used to perform bitwise AND between two expressions. In this article, we will explore the differences between the two operators and how to use them in Python. and operator & operator Used for logical operations Used for bitwise operations Returns boolean value Returns integer value Evaluates both operands Compares the binary representation of operands Short circuits if the first operand is false Perform operation ... Read More

Difference Between ‘+’ and ‘append’ in Python with examples

Rohan Singh
Updated on 17-Apr-2023 09:52:11

2K+ Views

In Python, the + operator is used to concatenate two lists or strings together and return a new string whereas the append operator is used to add elements to the end of an existing string. The + acts as an operator whereas append() is a method in Python. In this article, we will understand the differences between the + operator and the append() method in Python. + operator append() method Purpose concatenation adds an element to the end Type operator method Input Two or more strings/list One element output ... Read More

Difference between __sizeof__() and getsizeof() method in Python

Rohan Singh
Updated on 17-Apr-2023 09:50:31

5K+ Views

The __sizeof__() method and the getsizeof() method both are used to get the size of the objects used in the program. The getsizeof() method returns an additional overhead for garbage collection along with each element size of the list. The __sizeof__() method returns the actual size of the object without any overhead. In this article, we will see how we can differentiate these operators in Python. __sizeof__() operator getsizeof() The __sizeof__() operator returns the size of the object without any extra overhead for garbage collection. The getsizeof() operator returns the size of the object with extra ... Read More

Difference between '__eq__' VS 'is' VS '==' in Python

Rohan Singh
Updated on 17-Apr-2023 10:09:42

8K+ Views

The __eq__, ‘is’ and == operators in Python are used to compare the equality of objects in Python. The __eq__ method checks for the equality of objects of the same class or if we want to make a custom comparison function. The ‘is’ operator checks for the memory location of the two objects whereas the == operator checks only the value of the two objects being compared. In this article, we will discuss the difference between the three operators and their uses. Method Functionality Syntax __eq__ Checks for equality of objects values between two objects of ... Read More

Swift Program to Implement Binary Search Algorithm

Ankita Saini
Updated on 13-Apr-2023 11:43:30

2K+ Views

In swift, Binary search algorithm is used to search element from the sorted array. It repeatedly divides the search interval into half and then search the specified element. In the binary search algorithm, the input array must be in sorted order to reduce the time complexity. Algorithm Step 1 − Create a function to implement a binary search algorithm. Step 2 − Inside the function, first we find the lower bound and upper bound range of the given array. Step 3 − Run a while loop till LBound

Difference between != and is not operator in Python

Rohan Singh
Updated on 17-Apr-2023 09:48:50

8K+ Views

The != operator checks if the value of both the objects being compared have the same value or not. On the other hand “is not” operator checks if both the objects being compared are not pointing to the same reference. If the objects being compared are not pointing to the same reference then the “is not” operator returns true otherwise false. In this article, we will discuss how != and “is not” operators are used and what are the differences between them. != operator “Is not” operator The != operator compares only the value of the ... Read More

Active product sales analysis using matplotlib in Python

Rohan Singh
Updated on 17-Apr-2023 09:46:31

2K+ Views

Matplotlib in Python has various functions like read_csv, sort_values, group_by, etc to perform sales data analysis. Every online business which is involved in product sales of any type uses product sales data analysis to increase their sales and know their customers better. Any company which is involved in any type of e-commerce business uses its sales and customer data to identify trends, patterns, and insights that can be used to improve sales and revenue. The sales data can be used to determine which product has the highest traction, which festive season has the highest demand, and many other trends which ... Read More

Activation Functions in Pytorch

Rohan Singh
Updated on 17-Apr-2023 09:44:19

1K+ Views

Pytorch is an open-source machine learning framework that is widely used to create machine learning models and provides various functions to create neural networks. The activation function is a key component of neural networks. The activation function determines the output of a node in the neural network given an input or set of inputs to the node. The activation function introduces non-linearity in the output of a node of the neural network which is necessary for solving complex machine-learning problems. What is an Activation Function ? Neural networks in artificial intelligence consist of an input layer, a hidden layer, and ... Read More

Advertisements