Found 27104 Articles for Server Side Programming

Find the text of the given tag using BeautifulSoup

Atharva Shah
Updated on 21-Aug-2023 16:10:10

3K+ Views

BeautifulSoup is a powerful tool that makes it easy to extract information from HTML and XML documents primarily developed in Python for the purpose of web scraping and web data extraction. One of the most useful features of BeautifulSoup is the ability to find specific tags within a document. In this blog, we will explore how to use BeautifulSoup to find the text of a given tag along with a few examples. Installation and Syntax Installing BeautifulSoup is necessary before using it so use the Python package manager and run the following command right inside your terminal. pip install beautifulsoup4 ... Read More

Find the sum and product of a NumPy array elements

Atharva Shah
Updated on 21-Aug-2023 15:13:05

292 Views

A Python package called NumPy is employed in scientific computing and to handle large-scale numerical data. It provides support for multi-dimensional arrays and matrices, as well as a large library of mathematical functions to manipulate them. In this tutorial, we will focus on two of the most commonly used NumPy functions: sum() and prod(). These functions are used to calculate the sum and product of all the elements in a NumPy array, respectively. Installation Get the numpy package installed using pip inside your terminal pip install numpy Import it as highlighted after successful installation − import numpy as np ... Read More

How to add Site Header, Site Title, Index Title in a Django Project?

Atharva Shah
Updated on 21-Aug-2023 15:10:42

361 Views

To make it simple for people to browse and comprehend the goal of the site, it's critical to have a clear and succinct site header, site title, and index title when constructing a Django project. You must specify the site header, site title, and index title in your Django application's HTML templates in order to add them to the site. Every page of your website will have these components, making it simpler for visitors to browse and comprehend the goal of your project. These additions are especially helpful for complicated, huge websites that users may have trouble navigating. We will ... Read More

How to add RSS Feed and Sitemap to Django project?

Atharva Shah
Updated on 21-Aug-2023 15:09:35

89 Views

Introduction The incorporation of web components like Sitemaps and RSS (Really Simple Syndication) Feeds can provide a multitude of benefits such as enhancing user accessibility, augmenting website content consumption, and improving search engine performance. Developers can leverage Django to streamline the process of constructing web applications, resulting in the creation of websites that are exceptionally effective and user-friendly. What is RSS and Sitemap? RSS Feeds are XML files that include summaries of the material on a website, like article headlines and descriptions. Users may simply get the material without visiting the website by reading these files using RSS readers. On ... Read More

Toggle First and Last Bits of a Number

Vanshika Sood
Updated on 17-Aug-2023 20:02:03

422 Views

The following article provides an in depth explanation of the method used to modify a number by toggling its first and last bit using bitwise operators. A bitwise operator is an operator that can be used to manipulate individual bits in binary numbers or bit patterns. Problem Statement For a given number n, modify the number such that the first and the last bit of the binary expansion of the new number are flipped i.e. if the original bit is 1 then the flipped bit should be 0 and vice versa. All the bits between the first and the last ... Read More

The Sum of the Fifth Powers of the First n Natural Numbers

Vanshika Sood
Updated on 17-Aug-2023 20:00:47

352 Views

Natural numbers are numbers that start from 1 and include all the positive integers. The following article discusses two possible approaches to compute the sum of the fifth powers of the first n natural numbers. The article discusses the two approaches in detail and compares them with regards to efficiency and intuitiveness. Problem Statement The purpose of this problem is to compute the arithmetic sum of the first n natural numbers, all raised to their fifth power i.e. $\mathrm{1^5 + 2^5 + 3^5 + 4^5 + 5^5 + … + n^5}$  till the nth term. Examples Since n is a ... Read More

Pernicious Number

Vanshika Sood
Updated on 17-Aug-2023 19:47:00

106 Views

A number is considered to be pernicious if the number is a positive integer and the number of set bits in its binary expansion are prime. The first pernicious number is 3, as 3 = (11)2. It can be seen that the number of set bits in the binary representation of 3 are 2, which is a prime number. The first 10 pernicious numbers are 3, 5, 6, 7, 9, 10, 11, 12, 13, 14. Interestingly, powers of 2 can never be pernicious since they always have only 1 set bit. 1 is not a prime number. On the other ... Read More

Odious Number

Vanshika Sood
Updated on 17-Aug-2023 19:40:24

175 Views

A number is considered to be an odious number if it has an odd number of 1s in its binary expansion. The first 10 odious numbers are 1, 2, 4, 7, 10, 11, 13, 14, 16, 19, 21. Interestingly, all powers of 2 are odious since they have only 1 set bit. The following article discusses 2 approaches in detail to find whether a number is an odious number or not. Problem Statement This problem aims to check whether the given number is an odious number i.e. it is a positive number with an odd number of set bits in ... Read More

Minimum time required to complete all tasks without altering their order

Shubham Vora
Updated on 18-Aug-2023 15:12:35

104 Views

In this problem, we need to find the total time required to complete all tasks according to the given condition. We can use the map data structure to solve the problem. We can keep tracking the last performed time for each task, and if the time interval is less than K, we can increment time units accordingly. Problem statement – We have given a string task containing alphabetical characters of length N. Each character represents a task, and we need one unit of time to perform the tasks. Also, the condition is that each task should be performed at ... Read More

Minimum increments by 1 or K required to convert a string into another given string

Shubham Vora
Updated on 18-Aug-2023 15:10:46

338 Views

We have given two strings and need to convert one string to another by click increments, and we can increment characters by either 1 or k in the single operation. To solve the problem, we need to make all characters of the first string the same as a second character by performing the cyclic increment operations. If the character at the same index in both strings is the same, we don’t need to perform any increment operation. Problem statement – We have given two strings named first and second containing the uppercase alphabetical characters. The length of both strings ... Read More

Advertisements