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 sort list of tuples | descending, first, second, last, multiple elements, value, alphabetically

Python sort list of tuples using sort method needed key which sorts lists in place. And also offers a convenient way to sort tuples based on the index of tuple elements. You can sort list of tuples by first and second element by using index or values. tup[0] to sort on first tuple element tup[1] to sort on Read More…


Difference between sort vs sorted Python Function

You can sort the list using sort() or sorted() Python function. You must be thinking about then what is the difference sort() and sorted() funciton. The main difference between the list sort() and sorted() Python function is that the sort() function will modify the list it is called on. The sorted() function will create a new list containing a sorted version of Read More…


Python iterable object | Lists, tuples, dictionaries, and sets

Python iterable objects are capable of returning its members one at a time, permitting it to be iterated over in a for-loop. Examples of iterables include all sequence types (such as list, str, and tuple) and some non-sequence types like dict, file objects, and objects of any classes you define with an __iter__() or __getitem__() method. Remember:- Read More…


Python list (Array) methods | remove, insert, pop, reverse, count, sort, append, copy

Python List has built-in methods that you can use to important operations in the list data structure. Python List function is changed from time to time in different versions. The most basic and important data structure in Python is the List. In this tutorial you will learn about list methods of object in Python 3. Here are Read More…


Python list copy Function | copying(cloning) a List examples

Python list copy method returns a copy of the specified list. It returns a shallow copy of the list. What is a shallow copy? Shallow copy is a bit-wise copy of an object. A new object is created that has an exact copy of the values in the original object. So, if you need the original list unchanged when the Read More…


Python list extend Function | Adding all items of a list example

Python extend() function is used to adds the specified list elements (or any iterable) to the end of the current list. In simple word can say extend() method appends the contents of seq to list. Note: Python list extend returns none, only modifies (Add new elements) the original list. Syntax

Parameter Values Required single argument (a list) and Read More…


Python frozenset() Function | immutable List, Tuple, Dictionary Examples

What is Python frozenset and frozenset() function? Python frozenset is an immutable object and frozenset() method returns a frozenset object initialized with elements from the given iterable. The frozenset() is an inbuilt function in Python. More about Frozen set: It’s just an immutable version of a Python set object. While elements of a set can be modify elements but frozen Read More…