Difference between exports and module.exports in Node.js

When you have large javascript file, you want to break that file into independent modules so that you can reuse each modul ... xports. exports = {}, module.exports = [funciton] This will return non-empty object. So this also works. Loading…

Getting Started with Python

To get started with python, we need to download python from the official website. Python is a cross-platform language meanin ... check out Hello World example to get started. (adsbygoogle = window.adsbygoogle || []).push({}); Loading…

Python Program to Check Armstrong Number

In this example, we will write a simple program to take input number from the user and display whether the number is Armstr ... the number, then it is an Armstrong number. (adsbygoogle = window.adsbygoogle || []).push({}); Loading…

Linear Regression in Machine Learning

Linear regression is used in machine learning to predict the output for new data based on the previous data set. Suppose ... Descent(X,y,theta, alpha, num_iters) plt.plot(X[:,1], np.dot(X,theta)) #plt.legend('right') plt.show() Loading…

Liang-Barsky Line Clipping Algorithm with C/C++

Theory In Liang-Barsky algorithm, we first write the point-clipping conditions in parametric form as Each of these for ine ... operating system */ return 0; } Output (adsbygoogle = window.adsbygoogle || []).push({}); Loading…

Simulation of Non-deterministic finite state automata using backtracking feature of prolog.

Let us now see how the features of prolog can be used to simulate a non-deterministic automata which would have been a cu ... ),     accepts(S1,X).GOAL Accepts(S,[a,b]). (adsbygoogle = window.adsbygoogle || []).push({}); Loading…

Python List

Contents Python list is ordered data type i.e. with heterogeneous data. List are enclosed in brackets [] with items comma ... clear() Removes all items from the list   (adsbygoogle = window.adsbygoogle || []).push({}); Loading…

Python Dictionary

Contents A python dictionary is ordered data type i.e. with heterogeneous data containing key and values. Dictionaries are ... ue pairs from other, overwriting existing keys. values() Return a new view of the dictionary’s values   Loading…

Python Tuple

Contents Python tuple is a list of immutable objects with heterogeneous data. Tuples are enclosed in brackets () with item ... eturns the index of the first matched item   (adsbygoogle = window.adsbygoogle || []).push({}); Loading…

Python Set

Contents Python set is an unordered collection of items which are unique within that set. The order in which item in sets ... he set with the union of itself and others   (adsbygoogle = window.adsbygoogle || []).push({}); Loading…

Python Loops

In a programming language, there comes a case when we need to repeat some block of codes for a certain number of times or u ... on. We may update the loop by increment, decrement operators or by using any other arithmetic operators. Loading…

Python Strings

Contents A string is a character of sequence in any programming language. Python provides a powerful set of operations and ... OHN DOE [‘Python’, ‘is’, ‘fun’, ‘to’, ‘program’] Length of test string is: 24 Python is awesome to program Loading…

Python Program to Count the Frequency of Words in a File

In this example, we will write a python program to find the frequency of the words present in the file. To better understan ... ictionary of words with the count frequnecy. (adsbygoogle = window.adsbygoogle || []).push({}); Loading…

Python Lambda Functions

Contents (adsbygoogle = window.adsbygoogle || []).push({}); 1 What are lambda functions in Python? 2 How to u ... um = reduce((lambda x, y: x + y), mylist) print("Sum = ", sum) The output of the program is:- Sum = 1532 Loading…

Python Function Arguments

Contents Arguments are the parameters that we pass to a function that helps function to do the operation as per the argume ... John", "Tom", "Luke") The output of the above program is as below:- Hello, John Hello, Tom Hello, Luke Loading…

Python Recursive Functions

A recursive function is one which calls itself. Recursive functions provide some fruitful advantages over normal functions t ... ive calls are inefficient as they take up a lot of memory and time. Recursive functions are hard to debug. Loading…

C++ Tutorial: Objects and Classes in C++

A class is an expanded concept of a data structure: instead of holding only data, it can hold both data and functions. An ... ata members of their respective objects rect and rectb. (adsbygoogle = window.adsbygoogle || []).push({});

C++ Tutorial: Operator Overloading

C++ incorporates the option to use standard operators to perform operations with classes in addition to with fundamental t ... defined and basic or between user defined themselves. (adsbygoogle = window.adsbygoogle || []).push({});

C Programming: Strings

IA string is a sequence of characters( Array of character)  that is treated as a single data item. Any group of characters ... h %[^\n] as format specification or use gets(string_name). (adsbygoogle = window.adsbygoogle || []).push({});

C++ Tutorial: Passing arguments by reference and returning by reference.

Pass by Reference Pass by reference in C++ is implemented as the variable aliasing. The function definition for pass by re ... at are passed as reference to the function. (adsbygoogle = window.adsbygoogle || []).push({}); Loading…