What does the \’b\’ character do in front of a string literal in python

By: BHUVANESHWARI In python , the ‘b’ character before a string is used to specify the string as a “byte string”. By adding  the ‘b’ character before a string literal, it becomes a bytes literal. The string content should be a series of bytes and not character. Bytes literals are utilized  for representing binary data …

What does the \’b\’ character do in front of a string literal in python Read More »

Python program to create a class which performs basic calculator operations.

In Python Programming Language , a class is a blueprint for creating objects . It defines the attributes and behaviours that the objects will have. Basic calculator consists of operations like addition, subtraction, multiplication, division. class Calculator: def add(self, x, y): return x + y def subtract(self, x, y): return x – y def multiply(self, …

Python program to create a class which performs basic calculator operations. Read More »

str() vs repr() function in python

by : D.BHUVANESHWARI str() vs repr() function in python str() : This function is used to represent the string. Python programming language is used to convert the specified value into a string datatype. str() function Syntax: str(object, encoding=’utf-8?, errors=’strict’) object: The object whose string representation is to be returned. encoding : Encoding of the given …

str() vs repr() function in python Read More »

How to remove last n number of elements from an array in java

In this article, we will learn how to remove last n  number of elements from an array in java . Let’s understand what is an array? An array in programming is a sequential collection of items of the same type stored in contiguous memory locations, allowing easy access to elements by calculating their positions relative to the …

How to remove last n number of elements from an array in java Read More »

How to create a list using List.of() method in java

Creating a List using ‘List.of()’ : This method was introduced in java 9 as part of the java collection framework enhancements. The “List.of()’ method can be used to create a list with up to 10 elements. Steps to how to create a list using List.of() method in java Step-1: Import the List class: import java.util.List; …

How to create a list using List.of() method in java Read More »

Scroll to Top