10 Useful Python 3 String Slice Examples

We can extract a substring (a part of a string) from a string by using a slice in Python We define a slice by using square brackets, a start offset, an end offset, and an optional step count between them. We can omit some of these. The slice will include characters from offset start to […]

3 Examples to append to list in Python 3

List in Python are indexed and have a definite count while initializing. The elements in a list are indexed according to a definite sequence and the indexing of a list is done with 0 being the first index and the last item index is n-1 where n is the number of items in a list. […]

3 Examples to Get List Length in Python 3

List in python language is used to store multiple elements in a single variable. Lists are one of the 4 data types in python language along with tuple, set, and dictionary. List in Python is created by putting elements inside the square brackets, separated by commas. A list can have any number of elements and […]

3 Examples to Get Last Element of A List In Python 3

A list is a collection of arbitrary objects, somewhat akin to an array in many other programming languages but more flexible. Lists are defined in Python by enclosing a comma-separated sequence of objects in square brackets ([]). we have 3 ways to get the last element of the list in Python. Using list[-1] syntax Using […]