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 V Jyothi
54 articles
How to format numbers to strings in Python?
You can format numbers to strings in Python using several methods: the format() function, f-strings, and the % operator. Each approach allows you to control precision, width, and alignment. Formatting Floating Point Numbers Use the format() function to control decimal places and field width ? nums = [0.555555555555, 1, 12.0542184, 5589.6654753] for x in nums: print("{:10.4f}".format(x)) The output of the above code is ? 0.5556 1.0000 12.0542 5589.6655 The format {:10.4f} means: 10 characters ...
Read MoreHow to loop through multiple lists using Python?
When working with multiple lists, Python provides several ways to iterate through them simultaneously. The most common approaches are using range() with indexing, zip() for parallel iteration, and enumerate() when you need indices. Using range() with Indexing The most straightforward approach uses an external iterator to keep track of indices. This method works well when all lists have the same length ? numbers1 = [10, 12, 14, 16, 18] numbers2 = [10, 8, 6, 4, 2] for i in range(len(numbers1)): print(numbers1[i] + numbers2[i]) 20 20 20 20 20 ...
Read MoreQuerying SAP database using Python
Python is one of the most widely used object-oriented programming languages, known for its simplicity and readability. When working with enterprise systems, connecting Python to SAP databases is a common requirement for data extraction and analysis. To connect Python with SAP systems, we need to install the PyRFC module, which provides Python bindings for SAP Remote Function Calls (RFC). This module enables seamless communication between Python applications and SAP systems. Installing PyRFC Before querying SAP databases, you need to install the PyRFC package and SAP NetWeaver RFC Library ? pip install pyrfc Note: ...
Read MoreHow to specify that the audio/video will start over again, every time it is finished in HTML?
Use the loop attribute to specify that the audio/video will start over again every time it is finished. The loop attribute is a boolean attribute that, when present, causes the media to automatically restart from the beginning once it reaches the end. Syntax Following is the syntax for the loop attribute − For audio elements − Using Loop with Video Element The loop attribute works with the HTML5 element to create continuous playback. When the video ...
Read MoreExecute a script when the element gets focus in HTML?
The onfocus attribute in HTML executes a JavaScript function when an element receives focus. Focus occurs when a user clicks on an input field, tabs to it using the keyboard, or programmatically selects it. This attribute is commonly used with form elements like input fields, text areas, and select dropdowns. Syntax Following is the syntax for the onfocus attribute − The onfocus attribute accepts a JavaScript function call or inline JavaScript code that executes when the element gains focus. Example − Input Field Focus Following example demonstrates how to change the ...
Read MoreHow to set what browsers will show that do not support the ruby element?
The HTML tag specifies what browsers will show when they do not support the element. Ruby annotations are used in East Asian typography to provide pronunciation guides or semantic information for characters, commonly seen in Japanese furigana and Chinese pinyin. Syntax Following is the syntax for the tag − base_text fallback_openannotationfallback_close The (ruby parentheses) element contains fallback text that displays in browsers without ruby support. Modern browsers that support ruby annotations hide the content inside tags, while older browsers display it as regular text. ...
Read MoreCapitalize text with CSS
To capitalize text in CSS, use the text-transform property with the capitalize value. This property transforms the first letter of each word to uppercase while keeping the rest lowercase. Syntax text-transform: capitalize; Basic Example Here's how to capitalize text using CSS: hello world from india Hello World From ...
Read MoreUsage of text-align property in CSS
The text-align property in CSS controls the horizontal alignment of text content within its container. It accepts several values to position text left, right, center, or justify it across the available width. Syntax text-align: left | right | center | justify | start | end; Property Values Value Description left Aligns text to the left (default) right Aligns text to the right center Centers text horizontally justify Stretches text to fill the full width Example Here's how to use different ...
Read MoreHow to allow long and unbreakable words to be broken and wrap to the next line in JavaScript?
Use the wordWrap CSS property in JavaScript to allow long and unbreakable words to be broken and wrap to the next line. This property is especially useful when dealing with long URLs, email addresses, or continuous text that would otherwise overflow their container. Syntax element.style.wordWrap = "break-word"; wordWrap Property Values Value Description normal Default behavior - only ...
Read MoreHow to add properties and methods to an object in JavaScript?
In JavaScript, you can add properties and methods to objects using several approaches. The most common methods include direct assignment, using the prototype property for constructor functions, and using Object.defineProperty(). Method 1: Direct Property Assignment The simplest way to add properties to an existing object is direct assignment: Direct Property Assignment let car = { brand: "Toyota", ...
Read More