Javascript indexof Method | Search specified item/string in the Array/String

Javascript indexOf method searches a specified item or string in the Given Array/String and returns its position. Basically you can find the item or word present in the given string/Array. For String search, it will return the position of the first occurrence of a specified value in a string. And For Array item, it will search Read More…


Javascript substring method | Get Substring of given string example

Javascript substring Method is used to get the substring of the given String. Actually JS substring() method returns the part of the string between the start and end index. Syntax

Parameters indexStart (Start) – Integer value will the first character to include in the returned substring. indexEnd (End)– An optional integer value will the Read More…


Reverse a word in python | Letters in word and Sentences

It a very easy to Reverse words in a string python, you have to first Separate each word, then Reverse the word separated list and in the last join each word with space. For all this step you needed a split(), join() , reversed() function and list data structure. Algorithm of reverse words in a sentence Read More…


Reverse a number(integer) in python | Loop or Recursion

Numbers can be reversed in Python using different methods. Like loop or Recursion can use to reverse a number in python. let us take a look at the Python program to implement the same. Ways to reverse a number in Python Using a Loop Using Recursion Python programs to reverse a number Let’s see the both examples: Read More…


Python slice Function |::-1 shorthand, (Array, List, Tuple, String)

Python slice function returns a slice object that can use used to slice strings, lists(Array), tuple, etc. Means slice object is used to specify how to slice a sequence like strings, lists, tuples. Syntax

Parameters start  – The slicing of the object starts. Optional and Default is NONE. stop – The slicing stops at index stop -1 (last Read More…


Python list slice | Get specific sets of sub-elements Array

As you know Python List is a collection that is ordered and changeable. if you don’t know then you must read the first Python List tutorial. Python List Slicing is a way to get a range of items in a list. Note: List are index from 0 to size-1, with a step of 1. Syntax A syntax Read More…


Python slice string Function| Get a range of characters (SubString)

You can get a range of characters(substring) by using the slice function. Python slice() function returns a slice object that can use used to slice strings, lists, tuples. You have to Specify the parameters- start index and the end index, separated by a colon, to return a part of the string. Syntax

Parameters start Read More…


Python reverse string | Using loop, recursion, stack, slice, reversed

The string is a sequence of character data. There is no built-in function to reverse a string. But you can use slice, loop, recursion, reversed, join, etc function to reverse a string in python. Way to Python reverse string Loop – for-loop slice Recursion reversed with join() stack Example of Python reverse string We will see Read More…


Python sort dictionary by Value/Key | Ascending & Descending order examples

You can sort a dictionary in python by using the sorted() function. it is actually possible to do a “sort by dictionary values”.  You could use: sorted(d.items(), key=lambda x: x[1]) This will sort the dictionary by the values of each entry within the dictionary from smallest to largest. Python sort dictionary by value Example Python Read More…


Python sort string | alphabetically letters ascending/descending order

You can sort string in python using “join() + sorted()” and “sorted() + reduce() + lambda” method combinations. String can sort the letter/characters in ascending or descending alphabetically order. Example of Python sort string Let’ see the both ways example program. 1. Using join() + sorted() First sorted list of characters and then join the Read More…