We can add elements to a list using the append method. The
append() method adds a single element towards the end of a list.
For example, let’s extend the string by adding “April” to the list with the method
Python string method
split() inputs a string value & outputs a list of words contained within the string by separating or splitting the words on all the whitespaces by default. It also has an optional argument for limiting the number of splits.
split() method converts the string into other…
if…elif…else are conditional statements that provide us with the decision making that is required when we want to execute code based on a particular condition.
if…elif…else statement used in Python helps automate that decision making process.
if condition is considered the simplest of the three & makes a…
In Python, we can use a list function which creates a collection that can be manipulated for our analysis. This collection of data is called a list object.
While all methods are functions in Python, not all functions are methods. There is a key difference between functions & methods in…
Numpy’s random module, a suite of functions based on pseudorandom number generation. Random means something that can not be predicted logically.
In this example, we will stimulate a coin flip. We will use the function np.random(), …
Python’s rename column is a method used to change the column nambes with Pandas’ rename function. It’s useful when we load a tabular dataset that has no column names or if we want to assign different names to specific columns.
Its syntax is given as:
When working with data, we are often going to need to count items, create dictionaries values before we know keys to store them in, or maintain order in a dictionary.
Counter is a powerful tool for counting, validating, & learning more about the elements within a dataset that is found…
What Is String Formatting?
String formatting is attractively designing our string using formatting techniques provided by the particular programming language. We have different string formatting techniques in Python. We are now going to explore the new f-string formatting technique.
f-string evaluates at runtime of the program. …