Posts by Ria Sehgal

Author Biographical Info: Not available

Find the common keys from two dictionaries in Python

By Ria Sehgal

In this Python tutorial, we will see how to find the common keys from two dictionaries in Python. A dictionary is a collection of key-value pairs enclosed within curly brackets .... Read More

Reverse the order of lines of a .txt file in Python

By Ria Sehgal

Learn how to reverse the order of lines of a .txt file in Python. That means, the last line of the text file will appear first and the first line will appear last. This tutorial is.... Read More

Track the occurrences of a character in a string in Python

By Ria Sehgal

In Python, A string is a collection of characters enclosed in single (‘ ‘) or double (” “) quotes. This article is written to emphasize the Number of occurr.... Read More

Sum of values of elements in a Dictionary in Python

By Ria Sehgal

A dictionary is a collection of elements with key-value pairs. The values in the elements are accessed with the keys of that element. So let’s start learning: how to find the.... Read More

Run Length Encoding in a String in Python

By Ria Sehgal

Accessing each character in a string is possible using index slicing. Index 0 can be used to access the first character and so on.¬† For eg: str=”Happy”, the character .... Read More

Shifting Elements in a List to the Left in Python

By Ria Sehgal

In this tutorial, we will learn how to shift elements in a list to the left in Python with an example. Lists are is ordered and changeable collection. It is very much like arrays, .... Read More