Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Server Side Programming Articles - Page 1347 of 2650
13K+ Views
BeautifulSoup is a third party Python library that is used to parse data from web pages. It helps in web scraping, which is a process of extracting, using, and manipulating the data from different resources.Web scraping can also be used to extract data for research purposes, understand/compare market trends, perform SEO monitoring, and so on.The below line can be run to install BeautifulSoup on Windows −pip install beautifulsoup4Following is an example −Examplefrom bs4 import BeautifulSoup import requests url = "https://en.wikipedia.org/wiki/Algorithm" req = requests.get(url) soup = BeautifulSoup(req.text, "html.parser") print("The href links are :") for link in soup.find_all('a'): print(link.get('href'))OutputThe href links ... Read More
361 Views
Suppose we have a string s, we have to check whether we can split it into four sub-strings such that each of them are non-empty and unique.So, if the input is like s = "helloworld", then the output will be True as one of the possible set of sub-strings are ["hel", "lo", "wor", "ld"]To solve this, we will follow these steps −if size of s >= 10, thenreturn Truefor i in range 1 to size of s - 1, dofor j in range i + 1 to size of s - 1, dofor k in range j + 1 to ... Read More
334 Views
BeautifulSoup is a third party Python library that is used to parse data from web pages. It helps in web scraping, which is a process of extracting, using, and manipulating the data from different resources.Web scraping can also be used to extract data for research purposes, understand/compare market trends, perform SEO monitoring, and so on.The below line can be run to install BeautifulSoup on Windows −pip install beautifulsoup4Let us see an example −Exampleimport requests from bs4 import BeautifulSoup from urllib.request import urlopen import urllib url = 'https://en.wikipedia.org/wiki/Algorithm' html = urlopen(url).read() print("Reading the webpage...") soup = BeautifulSoup(html, features="html.parser") print("Parsing the webpage...") ... Read More
8K+ Views
Suppose we have a number n. We have to check whether the number n is perfect square or not. A number is said to be a perfect square number when its square root is an integer.So, if the input is like n = 36, then the output will be True as 36 = 6*6.To solve this, we will follow these steps −sq_root := integer part of (square root of n)return true when sq_root^2 is same as n otherwise falseExampleLet us see the following implementation to get better understanding − Live Demofrom math import sqrt def solve(n): sq_root = int(sqrt(n)) ... Read More
919 Views
BeautifulSoup is a third party Python library that is used to parse data from web pages. It helps in web scraping, which is a process of extracting, using, and manipulating the data from different resources. Also, it helps the developers in Natural Language Processing applications, helps analyse data, and extract meaning insights from it.Natural Language Processing, or NLP is a part of Machine Learning that deals with text data and ways of pre-processing it to supply it as input to a Machine Learning problem.Web scraping can also be used to extract data for research purposes, understand/compare market trends, perform SEO ... Read More
1K+ Views
Suppose we have a number n. We have to check whether n is an Emirp number or not. We all know Emirp number is (letters of prime in backward direction) is a prime number that results in a different prime when its digits are reversed.So, if the input is like n = 97, then the output will be True as the reverse of 97 is 79 which is another prime.To solve this, we will follow these steps −if num is not prime, thenreturn Falsereverse_num := reverse of numreturn true when reverse_num is prime otherwise falseExampleLet us see the following implementation ... Read More
186 Views
Suppose we a number n and another value x, we have to check whether it is a power of x or not, where x is a number power of 2.So, if the input is like n = 32768 x = 32, then the output will be True as n is x^3.To solve this, we will follow these steps −From the main method do the following −cnt := 0if n is not 0 and (n AND (n - 1)) is same as 0, thenwhile n > 1, don = n/2cnt := cnt + 1return cnt mod (log c base 2) is ... Read More
196 Views
Bokeh is a Python package that helps in data visualization. It is an open source project. Bokeh renders its plot using HTML and JavaScript. This indicates that it is useful while working with web-based dashboards.Bokeh converts the data source into a JSON file. This file is used as an input to BokehJS, which is a JavaScript library. This BokehJS is written in TypeScript that helps render visualization on modern browsers.Dependencies of Bokeh −Numpy Pillow Jinja2 Packaging Pyyaml Six Tornado Python−dateutilInstallation of Bokeh on Windows command promptpip3 install bokeh Installation of Bokeh on Anaconda promptconda install bokehExampleimport numpy as np ... Read More
275 Views
Bokeh is a Python package that helps in data visualization. It is an open source project. Bokeh renders its plot using HTML and JavaScript. This indicates that it is useful while working with web-based dashboards.Matplotlib and Seaborn produce static plots, whereas Bokeh produces interactive plots. This means when the user interacts with these plots, they change accordingly.Plots can be embedded as output of Flask or Django enabled web applications. Jupyter notebook can also be used to render these plots.Installation of Bokeh on Windows command promptpip3 install bokehInstallation of Bokeh on Anaconda promptconda install bokeh Let us see an example −ExampleFrom ... Read More
1K+ Views
Suppose we have a list of four sides, we have to check whether these four sides are forming a rectangle or not.So, if the input is like sides = [10, 30, 30, 10], then the output will be True as there are pair of sides 10 and 30.To solve this, we will follow these steps −if all values of sides are same, thenreturn Trueotherwise when sides[0] is same as sides[1] and sides[2] is same as sides[3], thenreturn Trueotherwise when sides[0] is same as sides[3] and sides[2] is same as sides[1], thenreturn Trueotherwise when sides[0] is same as sides[2] and sides[3] ... Read More