- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 34489 Articles for Programming
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
573 Views
News API is very famous API for searching and fetching news articles from any web site, using this API anyone can fetch top 10 heading line of news from any web site. But using this API, one thing is required which is the API key. Example Code import requests def Topnews(): # BBC news api my_api_key="Api_number” my_url = = " https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=my_api_key" my_open_bbc_page = requests.get(my_url).json() my_article = my_open_bbc_page["articles"] my_results = [] for ar in my_article: ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
1K+ Views
The Minkowski distance is a metric and in a normed vector space, the result is Minkowski inequality. Minkowski distance is used for distance similarity of vector. scipy.spatial.distance.minkowski >>> from scipy.spatial import distance >>> distance.minkowski([1, 0, 0], [0, 1, 0], 1) 2.0 >>> distance.minkowski([1, 0, 0], [0, 1, 0], 2) 1.4142135623730951 >>> distance.minkowski([1, 0, 0], [0, 1, 0], 3) 1.2599210498948732 >>> distance.minkowski([1, 1, 0], [0, 1, 0], 1) 1.0 >>> distance.minkowski([1, 1, 0], [0, 1, 0], 2) 1.0 >>> distance.minkowski([1, 1, 0], [0, 1, 0], 3) 1.0 Example code from math import * from decimal import Decimal ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
365 Views
Our task is to crawl a web page and count the frequency of the word. And ultimately retrieving most frequent words. First we are using request and beautiful soup module and with the help of these module creating web-crawler and extract data from web page and store in a list. Example code import requests from bs4 import BeautifulSoup import operator from collections import Counter def my_start(url): my_wordlist = [] my_source_code = requests.get(url).text my_soup = BeautifulSoup(my_source_code, 'html.parser') for each_text in my_soup.findAll('div', {'class':'entry-content'}): ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
264 Views
Here we are using regular expression package for extracting email-id from the URL-text file. Given the URL- text file. Using regular expression package we define the pattern of email-id then use findall() function, using this method to check the text which will match with this pattern. Input text= Please contact us at contact@tutorialspoint.com for further information."+\ " You can also give feedback at feedback@tutorialspoint.com" Output ['contact@tutorialspoint.com ', 'feedback@tutorialspoint.com'] Example code import re my_text = "Please contact us at contact@tutorialspoint.com for further information."+\ " You can also give feedback at feedback@tutorialspoint.com" my_emails = re.findall(r"[a-z0-9\.\-+_]+@[a-z0-9\.\-+_]+\.[a-z]+", ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
485 Views
Octal Number uses eight digits, 0, 1, 2, 3, 4, 5, 6, 7. Also called as base 8 number system. Each position in an octal number represents a 0 power of the base (8). Last position in an octal number represents a x power of the base (8). Decimal number system has base 10 as it uses 10 digits from 0 to 9. In decimal number system, the successive positions to the left of the decimal point represent units, tens, hundreds, thousands, and so on. Given a float decimal value and input the decimal places number, our task is to ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
3K+ Views
In this article, we will see how to convert floating-point value to binary. Binary uses two digits, 0 and 1. Also called as base 2 number system Each position in a binary number represents a 0 power of the base (2). Last position in a binary number represents a x power of the base (2). First, we take the integer part from the floating point value and convert it to binary then take fractional part and convert it to binary form and lastly combining both. Let’s say we have the following floating point number − 22.625 Convert decimal 22 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
2K+ Views
In this article, we will see how to right rotate a list from the given rotation number. A list has comma-separated values (items) between square brackets. Important thing about a list is that the items in a list need not be of the same type Let’s say the following is our input list − myList = [5, 20, 34, 67, 89, 94, 98, 110] The following is the output with n = 4 − 89, 94, 98, 110, 5, 20, 34, 67 Right rotate a list by n using slicing Here, slicing is used to right rotate a ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
272 Views
When we write something, many times happen with us that we misspelled some words. To overcome this problem, Python provides Enchant module. This is mainly used to check the spelling of words and suggest corrections for words that are miss-spelled. It is also used in many popular spellchecking packages to perform this task, including ispell, aspell and MySpell. It is very flexible at handling multiple dictionaries and multiple languages. For installing this, we use this command line in command prompt. pip install pyenchant Example Input >>> import enchant >>> d.suggest("prfomnc") Output::['prominence', 'performance', 'preform', 'Provence', 'preferment', 'proforma'] Example code ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
477 Views
This is very funny game. In this game no player is needed, it is an automatic game. Here we are using two Python modules numpy and random. In this game the mark on the board is put automatically instead of asking the user to put a mark on the board, and it will display the board after each turn unless a player wins. It returns -1 If the game gets draw. Example code import numpy as np import random from time import sleep # first creates an empty board def my_create_board(): return(np.array([[0, 0, 0], [0, ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
387 Views
Static C++ class members can be defined using the static keyword. The static member in a class is shared by all the class objects as there is only one copy of the static class member in the memory, regardless of the number of objects of the class.The static class member is initialized to zero when the first object of the class is created if it is not initialized in any other way.A program that demonstrates static class members in C++ is given as follows.Example Live Demo#include using namespace std; class Example { public : static int a; ... Read More