LCM of two Numbers in Python

In the previous article we explored about GCD and it’s implementation in Python. Now let us explore the concept of LCM and how we can arrive at the LCM of two Numbers in Python. Before we delve further into Python let us look at a problem which can further/or revise our understanding of LCM. We … Read more

Program to separate Even and Odd List Elements

In the previous article we explored how we could write a function to return the smaller elements from a list. Now we will apply similar logic to write a function to separate even and odd list elements. We are given a list, we need to write a function that takes the list as argument and … Read more

Average or Mean of a List in Python

In the previous article, we explored the concept of Comprehensions in Python. Now let us look at how we can obtain the average or mean of a list in Python. Let us look at an example, we have a list l1: l1=[10,20,30,40] There are four elements in the list, and the average can be obtained … Read more

Comprehensions in Python

In the previous article we saw how we could obtain the even and odd elements of a list, separately and return them. Now we will explore the concept of Comprehensions in Python with regards to lists, sets and dictionaries. What is List Comprehension? List Comprehension provides us a shortcut to create a new list from … Read more

Logical Operators in Python

In the previous article we have explored the various Arithmetic operations that can be utilized in Python, in this article we will further elaborate on logical operations that can be performed on files within Python. Logical operators in python are symbols or word used to combine expressions in such a way that the value of the … Read more

Arithmetic Operators in Python

At a basic level, computers only operate with numbers. Even within application programs in high-level languages, there are many numbers and operations internally. Fortunately, to get started it is enough to know the usual arithmetic. We will have a look at the various arithmetic operators in Python programming language. Arithmetic Operations & Arithmetic Operators in Python Before … Read more