w3resource
w3resource logo

Tutorials, Exercises recently published or updated on w3resource

C Exercises: Reads the side of a square and prints a hollow square using hash (#) character

C programming, exercises, solution: Write a C programming that reads the side (side sizes between 1 and 10 ) of a square and prints a hollow square using hash (#) character.

C Exercises: Reads the side of a square and prints square using hash (#) character

C programming, exercises, solution: Write a C programming that reads the side (side sizes between 1 and 10 ) of a square and prints square using hash (#) character.

C Exercises: Accepts one seven-digit number and separates the number into its individual digits, and prints the digits separated from one another by two spaces each

C programming, exercises, solution: Write a C programming that accepts one seven-digit number and separates the number into its individual digits, and prints the digits separated from one another by two spaces each.

C Exercises: Reads in a five-digit integer and determines whether or not it’s a palindrome

C programming, exercises, solution: Write a C programming Write a program that reads in a five-digit integer and determines whether or not it’s a palindrome.

C Exercises: Calculate and prints the squares and cubes of the numbers from 0 to 20

C programming, exercises, solution: Write a C programming to calculate and prints the squares and cubes of the numbers from 0 to 20 and uses tabs to display them in a table of values.

C Exercises: Reads an integer and count number of 3s in the given number

C programming, exercises, solution: Write a C programming which reads an integer (7 digits or fewer) and count number of 3s in the given number.

C Exercises: Reads in two integers and check whether the first integer is a multiple of the second integer

C programming, exercises, solution: Write a C programming that reads in two integers and check whether the first integer is a multiple of the second integer.

Python Scikit learn: Get the number of observations, missing values and nan values

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to get the number of observations, missing values and nan values.

Python Scikit-learn: K Nearest Neighbors - Create a plot of k values vs accuracy

Python Machine learning Scikit-learn, K Nearest Neighbors - Exercises, Practice and Solution: Write a Python program using Scikit-learn to split the iris dataset into 80% train data and 20% test data. Out of total 150 records, the training set will contain 120 records and the test set contains 30 of those records. Train or fit the data into the model and using the K Nearest Neighbor Algorithm and create a plot of k values vs accuracy.

Python Scikit learn: Print the keys, number of rows-columns, feature names and the description of the Iris data

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program using Scikit-learn to print the keys, number of rows-columns, feature names and the description of the Iris data.

Python Scikit-learn: Create a Principal component analysis of iris dataset

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to create a Principal component analysis (PCA) of iris dataset.

Python Scikit-learn: Create a hitmap using Seaborn to present their relations

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to find the correlation between variables of iris data. Also create a hitmap using Seaborn to present their relations.

Python Scikit learn: Create a 2-D array with ones on the diagonal and zeros elsewhere

Python Machine learning Scikit-learn - Exercises , Practice and Solution: Write a Python program to create a 2-D array with ones on the diagonal and zeros elsewhere. Now convert the NumPy array to a SciPy sparse matrix in CSR format.

Python Scikit-learn: Create a joinplot and add regression and kernel density fits using “reg” to describe individual distributions on the same plot between Sepal length and Sepal width

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to create a joinplot and add regression and kernel density fits using 'reg' to describe individual distributions on the same plot between Sepal length and Sepal width.

Python Scikit-learn: Create some basic statistical details like percentile, mean etc

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to view some basic statistical details like percentile, mean, std etc. of the species of ‘Iris-setosa’, ‘Iris-versicolor’ and ‘Iris-versicolor’.

Python Scikit-learn: Create a graph to find relationship between the sepal length and width

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to create a graph to find relationship between the sepal length and width.

Python Scikit learn: Print the shape of the data, type of the data and first 3 rows

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to load the iris data from a given csv file into a dataframe and print the shape of the data, type of the data and first 3 rows.

Python Scikit-learn: Create a graph to see how the length and width of SepalLength, SepalWidth, PetalLength, PetalWidth are distributed

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to create a graph to see how the length and width of SepalLength, SepalWidth, PetalLength, PetalWidth are distributed.

Python Scikit-learn: K Nearest Neighbors - Calculate the accuracy of the model using the K Nearest Neighbor Algorithm

Python Machine learning Scikit-learn, K Nearest Neighbors - Exercises, Practice and Solution: Write a Python program using Scikit-learn to split the iris dataset into 80% train data and 20% test data. Out of total 150 records, the training set will contain 120 records and the test set contains 30 of those records. Train or fit the data into the model and calculate the accuracy of the model using the K Nearest Neighbor Algorithm.

Python Scikit-learn: K Nearest Neighbors - Split the iris dataset into 70% train data and 30% test data

Python Machine learning Scikit-learn, K Nearest Neighbors - Exercises, Practice and Solution: Write a Python program using Scikit-learn to split the iris dataset into 70% train data and 30% test data. Out of total 150 records, the training set will contain 105 records and the test set contains 45 of those records. Predict the response for test dataset (SepalLengthCm, SepalWidthCm, PetalLengthCm, PetalWidthCm) using the K Nearest Neighbor Algorithm. Use 5 as number of neighbors.

Python Scikit learn: Get observations of each species from iris data

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to get observations of each species (setosa, versicolor, virginica) from iris data.

Python Scikit-learn: Create a box plot which shows the distribution of quantitative data in a way that facilitates comparisons between variables or across levels of a categorical variable of iris dataset

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to create a box plot (or box-and-whisker plot) which shows the distribution of quantitative data in a way that facilitates comparisons between variables or across levels of a categorical variable of iris dataset. Use seaborn.

Python Scikit-learn: Draw a scatterplot, then add a joint density estimate to describe individual distributions on the same plot between Sepal length and Sepal width

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to draw a scatterplot, then add a joint density estimate to describe individual distributions on the same plot between Sepal length and Sepal width.

Python Scikit-learn: Create a Pie plot to get the frequency of the three species of the Iris data

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to create a Pie plot to get the frequency of the three species of the Iris data.

Python Scikit-learn: Get the accuracy of the Logistic Regression

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to get the accuracy of the Logistic Regression.

Python Scikit-learn: Create a plot to get a general Statistics of Iris data

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to create a plot to get a general Statistics of Iris data.

Python Scikit-learn: K Nearest Neighbors - Create a plot to present the performance for different values of k

Python Machine learning Scikit-learn, K Nearest Neighbors - Exercises, Practice and Solution: Write a Python program using Scikit-learn to split the iris dataset into 80% train data and 20% test data. Out of total 150 records, the training set will contain 120 records and the test set contains 30 of those records. Train or fit the data into the model and using the K Nearest Neighbor Algorithm and create a plot to present the performance for different values of k.

Python Scikit-learn: K Nearest Neighbors - Convert Species columns in a numerical column of the iris dataframe

Python Machine learning Scikit-learn, K Nearest Neighbors - Exercises, Practice and Solution: Write a Python program using Scikit-learn to convert Species columns in a numerical column of the iris dataframe. To encode this data map convert each value to a number. e.g. Iris-setosa:0, Iris-versicolor:1, and Iris-virginica:2. Now print the iris dataset into 80% train data and 20% test data. Out of total 150 records, the training set will contain 120 records and the test set contains 30 of those records. Print both datasets.

Python Scikit-learn: Create a kde plot of petal_length versus petal width for setosa species of flower

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program using seaborn to create a kde (Kernel Density Estimate ) plot of petal_length versus petal width for setosa species of flower.

Python Scikit-learn: Create a joinplot to describe individual distributions on the same plot between Sepal length and Sepal width

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to create a joinplot to describe individual distributions on the same plot between Sepal length and Sepal width.

Python Scikit-learn: Create a joinplot using “kde” to describe individual distributions on the same plot between Sepal length and Sepal width and use ‘+’ sign as marker

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to create a joinplot using 'kde' to describe individual distributions on the same plot between Sepal length and Sepal width and use ‘+’ sign as marker.

Python Scikit learn: Drop Id column from a given Dataframe and print the modified part

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to drop Id column from a given Dataframe and print the modified part. Call iris.csv to create the Dataframe.

Python Scikit-learn: K Nearest Neighbors - Split the iris dataset into 70% train data and 30% test data

Python Machine learning Scikit-learn, K Nearest Neighbors - Exercises, Practice and Solution: Write a Python program using Scikit-learn to split the iris dataset into 70% train data and 30% test data. Out of total 150 records, the training set will contain 120 records and the test set contains 30 of those records. Print both datasets.

Python Scikit-learn: K Nearest Neighbors - Calculate the performance for different values of k

Python Machine learning Scikit-learn, K Nearest Neighbors - Exercises, Practice and Solution: Write a Python program using Scikit-learn to split the iris dataset into 80% train data and 20% test data. Out of total 150 records, the training set will contain 120 records and the test set contains 30 of those records. Train or fit the data into the model and using the K Nearest Neighbor Algorithm calculate the performance for different values of k.

Python Scikit learn: Access first four cells from a given Dataframe using the index and column labels

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to access first four cells from a given Dataframe using the index and column labels. Call iris.csv to create the Dataframe.

Python: Machine learning - Scikit-learn Exercises, Practice, Solution

Python Machine learning: Scikit-learn Exercises, Practice, Solution - Scikit-learn is a free software machine learning library for the Python programming language. It features various classification, regression and clustering algorithms including support vector machines, random forests, gradient boosting, k-means and DBSCAN, and is designed to interoperate with the Python numerical and scientific libraries NumPy and SciPy.

Python Scikit learn: View basic statistical details like percentile, mean, std etc. of iris data

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to view basic statistical details like percentile, mean, std etc. of iris data.

Python Scikit-learn: Create a Bar plot to get the frequency of the three species of the Iris data

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to create a Bar plot to get the frequency of the three species of the Iris data.

Python Scikit-learn: K Nearest Neighbors - Split the iris dataset into its attributes (X) and labels (y)

Python Machine learning Scikit-learn, K Nearest Neighbors - Exercises, Practice and Solution: Write a Python program to split the iris dataset into its attributes (X) and labels (y). The X variable contains the first four columns (i.e. attributes) and y contains the labels of the dataset.

Python Scikit-learn: Create a pairplot of the iris data set and check which flower species seems to be the most separable

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to create a pairplot of the iris data set and check which flower species seems to be the most separable.

Python Scikit-learn: Create a scatter plot using sepal length and petal_width to separate the Species classes

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to create a scatter plot using sepal length and petal_width to separate the Species classes.

Python Scikit-learn: Create a joinplot to describe individual distributions on the same plot between Sepal length and Sepal width

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to create a joinplot to describe individual distributions on the same plot between Sepal length and Sepal width.

Python Scikit-learn: Create a graph to find relationship between the petal length and width

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to create a graph to find relationship between the petal length and width.

Python Scikit-learn: Create a kde plot of sepal_length versus sepal width for setosa species of flower

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program using seaborn to Create a kde (Kernel Density Estimate ) plot of sepal_length versus sepal width for setosa species of flower.

Python Scikit-learn: Create a joinplot using “kde” to describe individual distributions on the same plot between Sepal length and Sepal width

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program to create a joinplot using 'kde' to describe individual distributions on the same plot between Sepal length and Sepal width.

Python Scikit-learn: Create a kde plot of two shaded bivariate densities of Sepal Width and Sepal Length

Python Machine learning Scikit-learn - Exercises, Practice and Solution: Write a Python program using seaborne to create a kde (Kernel Density Estimate) plot of two shaded bivariate densities of Sepal Width and Sepal Length.

Java Exercises: Convert 3 digits positive number in given format

Java programming exercises and solution: Write a Java program to convert 3 digits positive number in above format. For example, 234 should be output as BBSSS1234 because it has 2

Java Exercises: Accepts three integers and check whether sum of the first two given integers is greater than third one

Java programming exercises and solution: Write a Java program which accepts three integers and check whether sum of the first two given integers is greater than third one.

Java Exercises: Accepts students name, id, and marks and display the highest score and the lowest score

Java programming exercises and solution: Write a Java program which accepts students name, id, and marks and display the highest score and the lowest score.

Java Exercises: Accepts a string from the user and check whether the string is correct or not

Java programming exercises and solution: Write a Java program which accepts a string from the user and check whether the string is correct or not.

Mock Functions

Mock functions helps us make testing of links between code easy, by erasing the actual implementation of a function, capturing the calls to the function (and the parameters passed in those calls), capturing the instances of constructor functions when instantiated with the new keyword, and finally allowing test-time configuration of return values.

Migrating to Jest

Sometimes you might have started a project without having Jest as you preferred testing tool,

ES6 Class Mocks

You can use Jest to mock ES6 classes that are imported into files you want to test.

Snapshot Testing

Snapshot tests are a useful tool when you want to make sure your UI doesn�t change unexpectedly.

Using Jest with MongoDB and DynamoDB

Using the Global Setup/Teardown and Async Test Environment APIs, Jest will be able to work smoothly with MongoDB.

Setup and Teardown

Most times you have setup work that has to happen before the tests run, and there are some finishing works that has to happen after the tests run. Jest will provide helper functions to handle this.

Bypassing module mocks

Jest will allow you to mock out whole modules in your tests, which can be useful for testing if your code is calling functions from that module correctly.

DOM Manipulation

In this tutorial we are going to demonstrate how to perform DOM manipulation with Jest.

Using with DynamoDB

By using the Global Setup/Teardown and Async Test Environment APIs, Jest will work smoothly with DynamoDB.

An Async Example

First, you need to enable Babel support in Jest as documented in our tutorial for getting started with Jest.

Testing Asynchronous Code

When writing JavaScript codes, most times you will want to write asynchronously.

Using Matchers

Jest enables you to test values in different ways by using matchers.

Watch Plugins

In this tutorial, we will give you an in depth understanding of Jest?s Watch plugins.

Using with webpack

You can use Jest in projects that use webpack to manage assets, styles, and compilation.

Timer Mocks

The native timer functions (i.e., setTimeout, setInterval, clearTimeout, clearInterval) are less than ideal for use as a testing environment because they depend on real time to elapse.

Jest

The Jest framework is a delightful JavaScript Testing Framework with a focus on simplicity.

Manual Mocks

We use manual mocks to stub out functionality with mock data. For instance, rather than accessing a remote resource like a website or a database, you may want to create a manual mock that will allow you to use fake data.

Jest Getting Started

this documentation will use yarn commands, however, npm will also work.

Using with puppeteer

With the Async Test Environment and Global Setup/Teardown APIs, Jest will be able to work smoothly with puppeteer.

Jest Platform

You can use specific features of Jest as standalone packages by cherry picking them.

C# Sharp Exercises: Display a triangle

C# Sharp exercises and solution: Write a C# Sharp program that takes a number and a width as input and then displays a triangle of that width, using that number.

C# Sharp Exercises: Test a password

C# Sharp exercises and solution: Write a C# Sharp program that takes userid and password as input (type string). After 3 wrong attempts, user will be rejected.

C# Sharp Exercises: Calculate the speed in kilometers and miles per hour from distance and time

C# Sharp exercises and solution: Write a C# Sharp program that takes distance and time as input and displays the speed in kilometers per hour and miles per hour.

C# Sharp Exercises: Check a input is a vowel, a digit, or any other symbol

C# Sharp exercises and solution: Write a C# Sharp program that takes a character as input and check the input (lowercase) is a vowel, a digit, or any other symbol.

C# Sharp Exercises: Display three letters in reverse order

C# Sharp exercises and solution: Write a C# Sharp program to ask the user for three letters and display them in reverse order.

C# Sharp Exercises: Program to display certain values of the function

C# Sharp exercises and solution: Write a C# Sharp program to display certain values of the function x = y2 + 2y + 1 (using integer numbers for y, ranging from -5 to +5).

C# Sharp Exercises: Perform an operation on +, -, *, x, / and displays the result of that operation

C# Sharp exercises and solution: Write a C# Sharp program that takes two numbers and perform an operation (+,-,*,x,/) on them and displays the result of that operation.

C# Sharp Exercises: Create a list of numbers and display the numbers greater than 80

C# Sharp programming, exercises, solution: Write a program in C# Sharp to create a list of numbers and display the numbers greater than 80 as output.

C# Sharp Exercises: Display the characters and frequency of character from giving string

C# Sharp programming, exercises, solution: Write a program in C# Sharp to display the characters and frequency of character from giving string.

C# Sharp Exercises: Remove Items from List using remove function

C# Sharp programming, exercises, solution: Write a program in C# Sharp to Remove Items from List using remove function by passing object.

C# Sharp Exercises: Display top nth records from the list

C# Sharp programming, exercises, solution: Write a program in C# Sharp to display the top nth records.

C# Sharp Exercises: Remove Items from List by passing the item index

C# Sharp programming, exercises, solution: Write a program in C# Sharp to Remove Items from List by passing the item index.

C# Sharp Exercises: Find the uppercase words in a string

C# Sharp programming, exercises, solution: Write a program in C# Sharp to find the uppercase words in a string.

C# Sharp Exercises: Count File Extensions and Group it

C# Sharp programming, exercises, solution: Write a program in C# Program to Count File Extensions and Group it using LINQ.

C# Sharp Exercises: Find the strings for a specific minimum length

C# Sharp programming, exercises, solution: Write a program in C# Sharp to find the strings for a specific minimum length.

C# Sharp Exercises: Generate a Cartesian Product of two sets

C# Sharp programming, exercises, solution: Write a program in C# Sharp to generate a Cartesian Product of two sets.

C# Sharp Exercises: Display the number and frequency of number from given array

C# Sharp programming, exercises, solution: Write a program in C# Sharp to display the number and frequency of number from given array.

C# Sharp Exercises: Split a collection of strings into some groups

C# Sharp programming, exercises, solution: Write a program in C# Sharp to split a collection of strings into some groups.

C# Sharp Exercises: Find the string which starts and ends with a specific character

C# Sharp programming, exercises, solution: Write a program in C# Sharp to find the string which starts and ends with a specific character.

C# Sharp Exercises: Display the list according to the length then by name in ascending order

C# Sharp programming, exercises, solution: Write a program in C# Sharp to display the list of items in the array according to the length of the string then by name in ascending order.

C# Sharp Exercises: Remove Items from List by creating object internally by filtering

C# Sharp programming, exercises, solution: Write a program in C# Sharp to Remove Items from List by creating an object internally by filtering.

C# Sharp Exercises: Display the name of the days of a week

C# Sharp programming, exercises, solution: Write a program in C# Sharp to display the name of the days of a week.

C# Sharp Exercises: Find the number and its square of an array which is more than 20

C# Sharp programming, exercises, solution: Write a program in C# Sharp to find the number of an array and the square of each number which is more than 20.

C# Sharp Exercises: Display numbers, number*frequency and the frequency

C# Sharp programming, exercises, solution: Write a program in C# Sharp to display numbers, multiplication of number with frequency and the frequency of number of giving array.

C# Sharp Exercises: Remove range of items from list by passing start index and number of elements to delete

C# Sharp programming, exercises, solution: Write a program in C# Sharp to remove a range of items from a list by passing the start index and number of elements to remove.

C# Sharp Exercises: Convert a string array to a string

C# Sharp programming, exercises, solution: Write a program in C# Sharp to convert a string array to a string.

C# Sharp Exercises: Remove Items from List by passing filters

C# Sharp programming, exercises, solution: Write a program in C# Sharp to Remove Items from List by passing filters.

C# Sharp Exercises: Accept the members of a list and display the members more than a specific value

C# Sharp programming, exercises, solution: Write a program in C# Sharp to Accept the members of a list through keyboard and display the members more than a specific value.