Skip to main content

Posts

Python: calculating the area of circle

You can calculate the area of circle with and without using any variable. Both of these approaches are discussed below. Without using variable:- print (22.0 / 7) * (float(raw_input("Enter radius of the circle: ")) ** 2) With variable:- radius = float(raw_input("Enter radius of the circle: ")) print (22.0 / 7) * (radius ** 2)

Java implementing stack with custom class

If you want to create a custom class to implement stack in java, you can do something like this:- import java.util.ArrayList; import java.util.List; interface StackList<T> {     public boolean push(T data);     public T pop();     public int size(); } public class Stack<T> implements StackList<T> {     private final int max;     private int top = -1;     private final List<T> stack;     public Stack(int size) {         max = size - 1;         stack = new ArrayList<>(size);     }     public boolean push(T data) {         if (top <= max) {             top += 1;             stack.add(top, data);   ...

Should javascript be enabled or disabled?

Javascript Javascript is the most popular client-end scripting language used by every website.  Javascript provides a way to create custom tools for the websites which are used to improve the overall site quality and UI (User Interface). It's also popular as it allow the audio and video streaming too. Google used the javascript to load the web page contents dynamically i.e., instead of redirecting the user to a new page or refreshing the same page, the contents are updated on the required parts on the web page. This dynamic content loading approach is known as AJAX which has now become much more popular as almost every website is using this, at least, to validate the form. Javascript vs No-Javascript Some people often disable the javascript from their browser settings. If you are one of them and think that javascript is a security threat, then, you are completely wrong. Javascript is a way to improve the website quality according to the client's machine and navigato...