python

How to copy or clone a list in python

In this tutorial, we will learn how to copy or clone a list in python. After python 3.3, one new inbuilt method was added to copy a list. We will see two different processes to copy a list in python. Method 1 can be used in both python 2 and 3. But method 2 can only be used with python 3.

Read
java

Java program to find the total count of words in a string

In this tutorial, we will learn how to count the total number of words in a string in Java. The user will enter one string. Our program will count the total number of words in the string and print out the result.

Read
java

Java program to find the sublist in a list within range

In this tutorial, we will learn how to find one sublist of a list within a range. The user will enter the starting index and end index of the list. We will print out the sublist using this starting and ending index. Let's take a look at the Java program first :.

Read
c

C program to find the largest two numbers in a number array

In this tutorial, we will learn how to find the largest two numbers in a given array using the C programming language. The program will ask the user how many numbers the array will contain and the user will give us the input of each number. Our program will then find out the largest and second-largest numbers in the array.Let's take a look into the C program first. After that we will explain to you how the program works.

Read
c

C program to print alternate numbers of an user input array

In this tutorial, we will learn how to print alternate numbers of an array . User will enter the total count of numbers the array will hold. Then the program will take input for each position of that array. Let's take a look into the program first :.

Read
java

Java program to find the duplicate elements in an array of Strings

In this tutorial, we will learn how to find duplicate elements in an array of strings. We will learn this using two different approaches :.

Read
c

Compare two strings in C using strcoll()

In this tutorial, we will learn how to use strcoll() method in C to compare two different strings. The program will take two input strings from the user and compare them using strcoll() method. strcoll method has the following properties :.

Read
java

Java program to find count of words and find repeating words in a String

In this tutorial, we will learn how to print the count of each word in a string using Java. The user will first enter the string and then we will find the count and print out the result. Let's take a look at the program first :.

Read
c

C program to convert a decimal number to octal

In this tutorial, we will learn how to convert a decimal number to octal in c programming language. The octal number system is a base-8 number system. To represent one number in octal, digits from 0 to 7 is used. If a number is in decimal and if we want to convert it to octal, how to achieve it? Let's take a look at a simple example :Suppose we want to convert the number 100 to octal. We will keep dividing this number by 8 and keep appending the remainder till the number becomes 0 :.

Read
java

Java program to count the occurrence of each character in a string

In this tutorial, we will learn how to count the occurrence of each character in a String. The user will enter one string and we will count the occurrence of each character in that string. We will use one HashMap to store the character and count for that character. The key of that hash map is Character and value is Integer. Let's take a look at the Java program first :.

Read