Where are JavaScript Variables Stored

Samual Sam
Updated on 07-Jan-2020 06:58:27

2K+ Views

Like many other programming languages, JavaScript has variables. Variables can be thought of as named containers. You can place data into these containers and then refer to the data simply by naming the container.JavaScript variables get stored in the memory of the browser process. The following ways can work for storing variables:The variables which you declare in your JavaScript code gets saved in the memory of the browser process.Cookies can also store variables, they are often saved on your hard disk;

Windows Registry Access Using Python Winreg

Pradeep Elance
Updated on 07-Jan-2020 06:53:49

6K+ Views

As a versatile language and also availability of very large number of user supported modules, we find that python is also good at OS level programming. In this article we will see how python can access the registry of a windows operating system.We need to import the module named winreg into the python environment.In the below example we use the winreg module to first connect to the registry using the ConnectRegistry function and then access the registry using OpenKey function. Finally we design a for loop to print the result of the keys accessed.Exampleimport winreg #connecting to key in registry ... Read More

Filter Negative Values From Given Dictionary in Python

Pradeep Elance
Updated on 07-Jan-2020 06:48:05

542 Views

As part of data analysis, we will come across scenarios to remove the negative values form a dictionary. For this we have to loop through each of the elements in the dictionary and use a condition to check the value. Below two approaches can be implemented to achieve this.Using for loopW simply loop through the elements of the list using a for loop. In every iteration we use the items function to compare the value of the element with the 0 for checking negative value.Example Live Demodict_1 = {'x':10, 'y':20, 'z':-30, 'p':-0.5, 'q':50} print ("Given Dictionary :", str(dict_1)) final_res_1 ... Read More

Filter Even Values From a List in Python

Pradeep Elance
Updated on 07-Jan-2020 06:46:30

1K+ Views

As part of data analysis require to filter out values from a list meeting certain criteria. In this article we'll see how to filter out only the even values from a list.We have to go through each element of the list and divide it with 2 to check for the remainder. If the remainder is zero then we consider it as an even number. After fetching these even numbers from a list we will put a condition to create a new list which excludes this even numbers. That new list is the result of the filtering condition we applied.Using for ... Read More

Multiply Two Matrices in Single Line Using NumPy in Python

Pradeep Elance
Updated on 07-Jan-2020 06:41:16

744 Views

Matrix multiplication is a lengthy process where each element from each row and column of the matrixes are to be multiplied and added in a certain way. For matrix multiplication, the number of columns in the first matrix must be equal to the number of rows in the second matrix. The result matrix has the number of rows of the first and the number of columns of the second matrix.For smaller matrices we may design nested for loops and find the result. For bigger matrices we need some built in functionality in python to tackle this. We will see both ... Read More

All Possible Permutations of N Lists in Python

Pradeep Elance
Updated on 07-Jan-2020 06:34:45

1K+ Views

If we have two lists and we need to combine each element of the first element with each element of the second list, then we have the below approaches.Using For LoopIn this straight forward approach we create a list of lists containing the permutation of elements from each list. we design a for loop within another for loop. The inner for loop refers to the second list and Outer follow refers to the first list.Example Live DemoA = [5, 8] B = [10, 15, 20] print ("The given lists : ", A, B) permutations = [[m, n] for m in ... Read More

Convert Lowercase Characters to Uppercase Based on Co-Prime ASCII Value in C++

Ayush Gupta
Updated on 06-Jan-2020 12:24:57

142 Views

In this tutorial, we will be discussing a program to convert all lowercase characters to uppercase whose ASCII value is co-prime with k.For this we will be provided with a string and an integer value k. Our task is to traverse through the given string and change to uppercase all those characters whose ASCII value is co-prime with the given integer k.Example Live Demo#include using namespace std; //modifying the given string void convert_string(string s, int k){    int l = s.length();    for (int i = 0; i < l; i++) {       int ascii = (int)s[i];   ... Read More

Convert a Tree to Forest of Even Nodes in C++

Ayush Gupta
Updated on 06-Jan-2020 12:14:35

248 Views

In this tutorial, we will be discussing a program to convert a tree to a forest of even nodes.For this we will be provided with a binary tree of say N nodes. Our task is to calculate the maximum number of edges that can be removed to get forest of even nodes.Example Live Demo#include #define N 12 using namespace std; //returning the number of nodes of subtree //having the root node int depth_search(vector tree[N], int visit[N], int *ans, int node){    int num = 0, temp = 0;    //marking nodes as visited    visit[node] = 1;    for (int i ... Read More

Convert a String to Hexadecimal ASCII Values in C++

Ayush Gupta
Updated on 06-Jan-2020 12:10:54

2K+ Views

In this tutorial, we will be discussing a program to convert a string to hexadecimal ASCII values.For this we will be provided with a string of characters. Our task is to print that particular given string into its hexadecimal equivalent.Example Live Demo#include #include //converting string to hexadecimal void convert_hexa(char* input, char* output){    int loop=0;    int i=0;    while(input[loop] != '\0'){       sprintf((char*)(output+i), "%02X", input[loop]);       loop+=1;       i+=2;    }    //marking the end of the string    output[i++] = '\0'; } int main(){    char ascii_str[] = "tutorials point";   ... Read More

Convert String into Square Matrix Grid of Characters in C++

Ayush Gupta
Updated on 06-Jan-2020 12:06:36

394 Views

In this tutorial, we will be discussing a program to convert a string into a square matrix grid of characters.For this we will be provided with a string of characters. Our task is to print that particular string in the format of a matrix grid having a certain number of rows and columns.Example Live Demo#include using namespace std; //converting the string in grid format void convert_grid(string str){    int l = str.length();    int k = 0, row, column;    row = floor(sqrt(l));    column = ceil(sqrt(l));    if (row * column < l)       row = column; ... Read More

Advertisements