Samual Sam has Published 2492 Articles

Python program to move spaces to front of string in single traversal

Samual Sam

Samual Sam

Updated on 23-Jun-2020 16:09:23

357 Views

Given a string that has set of words and spaces, our task is to move all spaces to front of string, by traversing the string only once. We will solve this problem quickly in Python using List Comprehension.ExampleInput: string = "python program" Output: string= “ pythonprogram"AlgorithmStep1: input a string with ... Read More

Program to check if a number is Positive, Negative, Odd, Even, Zero?

Samual Sam

Samual Sam

Updated on 23-Jun-2020 16:07:21

5K+ Views

Number is given, we have to check that the number is even or odd and positive or negative.AlgorithmStep 1: input number Step 2: check number is greater than equal to 0 or not. If true then positive otherwise negative and if it 0 then number is 0. Step 3: if ... Read More

Python Program to calculate n+nm+nmm.......+n(m times).

Samual Sam

Samual Sam

Updated on 23-Jun-2020 16:03:14

400 Views

Here n is given value which is positive number m is the number of times till which the series run. Our task is to calculate this series.AlgorithmStep 1: Input n, m; Step 2: Converting the number to string. Step 3: Initializing result as number and string. Step 4: Adding remaining ... Read More

visited pseudo class in CSS

Samual Sam

Samual Sam

Updated on 23-Jun-2020 15:45:52

107 Views

Pseudo class is to show different state of an element or a css selector. visited pseudo class is to show that the link is already visited.This pseudo class is mostly being associated with link.Syntaxa:visited { color:green;}Let's check the actual usage of :visited pseudo class with different scenarios, as follows -Example Live ... Read More

Get emotions of images using Microsoft emotion API in Python?

Samual Sam

Samual Sam

Updated on 23-Jun-2020 15:44:05

111 Views

Every human being have emotions just like happy, sad, neutral, surprise, sorrow etc., if we create the emotions of images like happy, sad, neutral, surprise, etc. in Python. We can use Microsoft emotion API for any development purpose.We can easily elaborate all these emotions using Microsoft emotion API's.Example Codeimport http.client, ... Read More

Extension Methods in C#

Samual Sam

Samual Sam

Updated on 23-Jun-2020 15:07:24

670 Views

Extension methods are static methods, which are called as if they were instance methods on the extended type. With Extension methods, you can add methods to existing types without even creating a new derived type, recompiling, or modifying the original type.The following is the extension method we have created.public static ... Read More

C# program to find Intersection of two lists

Samual Sam

Samual Sam

Updated on 23-Jun-2020 15:06:18

2K+ Views

To find intersection of two lists in C#, use the Intersect() method.The following is our list 1.List list1 = new List(); list1.Add(2); list1.Add(3); list1.Add(5); list1.Add(7);The following is our list 2.List list2 = new List(); list2.Add(5); list2.Add(4); list2.Add(6); list2.Add(8);The following is the code to find the intersection of two lists in ... Read More

How do we pass an array in a method in C#?

Samual Sam

Samual Sam

Updated on 23-Jun-2020 14:46:03

78 Views

Pass array in a method as a method argument.Let’s say the following is our array declaration and initialization.MyArray app = new MyArray(); /* an int array with 5 elements */ int [] balance = new int[]{1000, 2, 3, 17, 50};Now call the method getAverage() and pass the array as method ... Read More

How do you use a ‘for loop’ for accessing array elements in C#?

Samual Sam

Samual Sam

Updated on 23-Jun-2020 14:35:45

182 Views

The ‘for loop’ executes a sequence of statements multiple times and abbreviates the code that manages the loop variable.The following is our for loop.Example Live Demousing System; namespace ArrayApplication {    class MyArray {       static void Main(string[] args) {          int [] n = new ... Read More

How do we use continue statement in a while loop in C#?

Samual Sam

Samual Sam

Updated on 23-Jun-2020 14:31:50

147 Views

The continue statement causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating.The continue statement in C# works somewhat like the break statement. Instead of forcing termination, however, continue forces the next iteration of the loop to take place, skipping any code ... Read More

Advertisements