Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Yaswanth Varma
Page 29 of 31
How to get a variable name as a string in Python?
In Python Variables are just the labels that are pointing to the values. They don't carry any built-in metadata about their names. That’s why there is no direct built-in method to get the variable name as a string. However, we can achieve this, by inspecting the environment such as using the globals(), locals(), or the inspect module. Let's dive into the article to learn more about getting a variable name as a string. Using Python globals() Function The Python globals() function is used to return a dictionary representing the current global symbol table. It provides ...
Read MoreHow to get a function name as a string in Python?
In Python, Functions are the first-class object, which means they can be passed around and manipulated like other data types (like integers, strings). This allows to inspect and retrieve the attribute of functions, including their names. In this article we are going to learn about getting the function names as string, To achieve we are going to use the built-in __name__ attribute. Let's dive into the article to learn more about it. Using Python Class __name__ Attribute The Python __name__ attribute is a special built-in variable that helps to determine the context in a which a Python ...
Read MoreHow can we change the id of an immutable string in Python?
In Python, strings are immutable, which means once the string is created, it cannot be changed. Because of this immutability, any operation that tries to modify the string results in creating a new string object with a different identity. Every object in Python has a unique identity, which can be accessed by using the built-in id() function. In this article, we are going to learn about changing the id of an immutable string in Python. We cannot directly change the ID of the immutable string, but by reassigning or modifying it, we can create a new string and ...
Read MoreWhat does the \'b\' character do in front of a string literal in Python?
A string is a collection of characters that can represent a single word or a complete phrase. Since you can directly assign strings in Python to a literal (unlike other technologies) it is easy to use them. The string literals are typically enclosed in quotes (' ' or " ") and they represent a sequences of characters. However, in some scenarios we will encounter a string that starts with a lowercase b for example, b'WELCOME', Where the b prefix stands for bytes literal. Bytes literals are useful when dealing with binary data, where data is transmitted or ...
Read MoreHow to check if a string contains only decimal characters?
In many programming scenarios, it is common to validate the user input to ensure it contains the specified value. For example, when accepting age, pin-code or numbers form the user, we make sure the input is entered is completely digits. One specific way to do this is by checking if the string contains only decimal numbers. Decimal characters are the characters used to write base-10 numbers (the digits from 0-9). Python provides the built-in methods to perform this check easily, Let's dive into the article to learn more about it. Using Python isdecimal() Method The Python isdecimal() ...
Read MoreHow to translate a python string according a given dictionary?
In Python, translating the string using a dictionary is used for text manipulation, encoding. It is typically achieved by using the str.translate() method along with the str.maketrans() to define the character mappings. The dictionary passed to the maketrans() contains key-value pairs where the keys are characters to replace and values are their corresponding replacements. Let's dive into the article to learn more about translating a string using the dictionary. Using Python str.translate() Method The Python str.translate() method is a sequel for the maketrans() method in the string module. This method uses the translation table generated by the ...
Read MoreThe most important APIs in HTML5?
API is also known as "Application Programming Interface." It is a collection of definitions, tools, and protocols that enables interaction and communication across various software programs. Developers can engage with a service, library, or platform without having to understand all the techniques of how it operates since APIs define the methods and data structures they can utilize. APIs are essential for the development of software because they let programmers use the features and services offered by other software components to create more complex applications. They advance modularity and collaboration amongst various software systems. Let’s dive into the article to learn ...
Read MoreDifference between hover() and mouseover() methods in jQuery
The JavaScript library "jQuery" is regarded as the most effective lightweight JavaScript library. Based on the built-in methods, it encapsulates several lines of JavaScript code to carry out a given functionality. A single line of code can easily be used to call these methods. While doing the necessary operation, it shortens the code. Users can use a single line of code to invoke the "hover()" and "mouseover()" jQuery methods when their relevant events occur to carry out the task. Let’s dive into the article to learn more about the difference between hover() and mouseover() methods in jQuery. Before learning about ...
Read MoreExplain the concept of fade effect in jQuery?
The jQuery fade effect combines the ability to display and hide certain items while also including a transition animation. You can observe that the elements gradually fade in and out rather than appearing and disappearing right away. An effect like this could make the website look more spectacular and be more pleasant. There are different methods used for the creation of fading effects in jQuery like .fadeIn(), .fadeOut() , .fadeToggle() and .fadeTo() . Let’s look into them one by one. jQuery fadeIn() method The opacity of the matching items is animated using the .fadeIn() method. It is the same as ...
Read MoreFlipping Window Effect
The "flipping window" effect, also called the "window rotation" effect, is a visual occurrence that takes place when an object or scene is seen via a number of spinning windows or panels. To give viewers an immersive and engaging experience, the flipping window effect is frequently employed in interactive displays, digital animations, and art installations. Let’s dive into the article to draw a flipping window effect. It can be done by using CSS @keyframes. Let’s have a quick look at it before we jump into the article. CSS @keyframes Keyframes are used for animation in CSS. It provides you more ...
Read More