Skip to main content

Featured

Python To read the news

Hello Guys, in this blog we will use Python to read the news. Before this, the concepts of APIs, JSON, Python Libraries should be clear. We are going to use 'newsdataapi' library of Python. The newsdataapi is the official Python client library for the Newsdata.io API. Its primary purpose is to simplify the process of accessing global news data directly from Newsdata.io, allowing developers to integrate news content into their applications without having to manually construct HTTP requests. It acts as a wrapper around the API, handling the complexities of authentication, request parameters, and response parsing. So Lets Start. Making Python to read the online news Step 1: Get your API key Sign Up : Go to the Newsdata.io website and create a free account. The free plan typically offers a limited number of credits per day (e.g., 200 credits). Get the Key : Once you've created and verified your account, your unique API key will be available on your dashboard. Copy this key,...

Generating Random Number from Javascript

Hello guys, after reading this blog you will know how you can generate a random number through JavaScript

We can generate the random number through Math.random() function but this gives us number in decimal.
So we should write the Math.random()  * 10 inside the Math.floor to get a integer number not a decimal number from 0 to 10 (10 not included); In JavaScript Math is a object that helps you to do mathematical operations. And Math.floor() is a function that round offs the number and return a integer.


We can use different places where we have to make choosing from the computer. For example one array is there, from that array we have to make computer choose a array item.

Here's one code which help you in understanding 

arr = ["Rock", "Papper", "Scissor"]
random_num = Math.floor(Math.random() * arr.length)
alert(arr[random_num])

Comments

Popular Posts