enumerate() function in python

There are many situations where we'll need to iterate over multiple lists in tandem, such as this one: In the example above, we have two lists. The second list describes the viciousness of the animals in the first list. A Dog has a viciousness level of 1, and a SuperLion has a viciousness level of 10. We want to retrieve the position of the item in animals the loop … Continue reading enumerate() function in python

for loop in python

A for loop is used for iterating over sequence(i.e.  a list, tuple, dictionary, set, string). Syntax of for Loop: The for loop used in python is different from the for keyword used in other programming languages, and work more like iterator as found in other object-oriented programming languages. Example: >Even strings are iterable objects, they … Continue reading for loop in python

Python lambda (Anonymous Functions)

In python, a function without name is known as anonymous function. As we know that def keyword is used to define a normal function, but to define anonymous function lambda keyword is used to create an anonymous function. Lambda functions can take any number of arguments but only one expression, which is evaluated and returned. … Continue reading Python lambda (Anonymous Functions)

if,else,elif Statements in python

if Statements in Python allows us to tell the computer to perform alternative actions based on a certain set of results. Verbally, we can imagine we are telling the computer: "Hey if this case happens, perform some action" We can then expand the idea further with elif and else statements, which allow us to tell the computer: "Hey if this … Continue reading if,else,elif Statements in python