Pavitra has Published 177 Articles

List Methods in Python - in, not in, len(), min(), max()

Pavitra

Pavitra

Updated on 01-Jul-2020 07:19:09

17K+ Views

In this article, we will learn about various types of list methods available to us in Python 3.x. Or earlier. These operators allow us to perform the basic operations on the list content.In & Not in operators“in” operator  − This operator is used to check whether an element is present ... Read More

Iterate over a dictionary in Python

Pavitra

Pavitra

Updated on 01-Jul-2020 07:15:00

199 Views

In this article, we will learn about iteration/traversal of a dictionary in Python 3.x. Or earlier.A dictionary is an unordered sequence of key-value pairs. Indices can be of any immutable type and are called keys. This is also specified within curly braces.Method 1 − Using iterables directlyExampledict_inp = {'t':'u', 't':'o', ... Read More

Iterate over a list in Python

Pavitra

Pavitra

Updated on 01-Jul-2020 07:13:07

380 Views

In this article, we will learn about iterating/traversing over a list in Python 3.x. Or earlier.A list is an ordered sequence of elements. It is a non-scalar data structure and mutable in nature. A list can contain distinct data types in contrast to arrays storing elements belonging to the same ... Read More

Iterate over a set in Python

Pavitra

Pavitra

Updated on 01-Jul-2020 07:11:50

2K+ Views

In this article, we will learn about iterating/traversing over a set in Python 3.x. Or Earlier.It is an unordered collection of objects without any duplicates. This can be done by enclosing all the elements within curly braces. We can also form sets by using type casting via a keyword “set”.Method ... Read More

Iterate over characters of a string in Python

Pavitra

Pavitra

Updated on 01-Jul-2020 07:10:14

1K+ Views

In this article, we will learn about iterating/ traversing over characters of a string in Python 3.x. Or earlier.The string is a collection of characters which may contain spaces, alphabets or integers. They can be accessed using indexes or via references . Some commonly implemented methods are shown below.Method 1 ... Read More

Multi-Line printing in Python

Pavitra

Pavitra

Updated on 30-Dec-2019 10:26:04

637 Views

We have usually seen the print command in python printing one line of output. But if we have multiple lines to print, then in this approach multiple print commands need to be written. This can be avoided by using another technique involving the three single quotes as seen below.Example Live Demoprint(''' ... Read More

Contingency Table in Python

Pavitra

Pavitra

Updated on 30-Dec-2019 10:22:38

1K+ Views

A contingency table is a table showing the distribution of one variable in rows and another variable in columns. It is used to study the correlation between the two variables. It is a multiway table which describes a dataset in which each observation belongs to one category for each of ... Read More

Adding two Python lists elements

Pavitra

Pavitra

Updated on 30-Dec-2019 10:14:57

1K+ Views

Lists can be added in python resulting in creation of a new list containing elements from both the lists. There are various approaches to add two lists and they are described below. But in all these cases the lists must be of same length.Using Append()Using append() we can add the ... Read More

Python-program-to-convert-pos-to-sop

Pavitra

Pavitra

Updated on 24-Dec-2019 05:55:35

151 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given pos form we need to convert it into its equivalent sop formThe conversion can be done by first counting the number of alphabets in the pos form and then calculating all ... Read More

Python program to print all Prime numbers in an Interval

Pavitra

Pavitra

Updated on 24-Dec-2019 05:46:13

322 Views

In this article, we will learn about the solution to the problem statement given below.Problem statement − We are given an interval we need to compute all the prime numbers in a given rangeHere we will be discussing a brute-force approach to get the solution i.e. the basic definition of a ... Read More

Advertisements