Create Python Dictionary from List of Keys and Values

Akshitha Mote
Updated on 17-Apr-2025 16:41:25

24K+ Views

In Python, the dictionary is one of the built-in data types that stores the data in the form of key-value pairs. The pair of key-value is separated by a comma and enclosed within curly braces {}. The key and value within each pair are separated by a colon (:). Each key in a dictionary is unique and maps to a value. It is an unordered, mutable data. Creating dictionary from lists In Python, we can create a dictionary by using two separate lists. One list is considered as the keys, and the second one is considered as values. We ... Read More

C Program to Find Subarray with Sum Equal to 0

C
AYUSH MISHRA
Updated on 17-Apr-2025 15:42:28

435 Views

What is a Subarray? A subarray is a contiguous part of the array. The sum of elements in a subarray is the cumulative sum of elements of a subarray. For example: in the given array [1, 2, 3, 4, 5, 6] the subarray is [3, 4, 5]. In this article, we are given an array and need to find if any subarray has a sum equal to zero using C. Example 1 Input: arr[] = {4, 2, -3, 1} Output: Yes Explanation: The subarray {2, -3, 1} has a sum equal to 0. Example 2 ... Read More

Rotate Matrix by 90 Degrees in C

C
AYUSH MISHRA
Updated on 17-Apr-2025 13:29:28

3K+ Views

In this article, we are given an N x N matrix, and our task is to rotate it by 90 degrees clockwise in C. Example Input: [1 2 3], [4 5 6], [7 8 9] Output: [7 4 1], [8 5 2], [9 6 3] Below are different approaches to rotate a matrix by 90 degrees in the clockwise direction: Using Brute Force Approach Using In-Place Rotation Using Brute Force Approach This is the simple and direct approach to understand and implement. In this approach, we create a ... Read More

Difference Between Google Gemini 2.5 and ChatGPT-4

Peehu Sharma
Updated on 17-Apr-2025 12:32:31

320 Views

Gemini 2.5 and ChatGPT 4o are both advanced AI language models. Gemini 2.5 is developed by Google DeepMind and ChatGPT, developed by OpenAI. The difference between Gemini 2.5 and ChatGPT is that Gemini 2.5 handles complex reasoning and has multimodal capabilities, also can generate text, images, and more. ChatGPT is used to generate creative content. It supports coding, writing assistance, and detailed explanations across various topics. In this article, learn the difference between Gemini 2.5 and ChatGPT in detail. What is Gemini 2.5? Gemini 2.5 is the latest version of Google's AI model and part of the Gemini AI series ... Read More

Difference Between Joomla and Tumblr

Peehu Sharma
Updated on 17-Apr-2025 12:04:06

130 Views

Joomla is a Content Management System (CMS) platform, whereas Tumblr is a microblogging platform focused on sharing short-form content like text, images, and videos in a visually appealing and social manner. This article will highlight the differences between Joomla and Tumblr. But before discussing the differences, let us first examine their basics. What is Joomla?Joomla is an open-source software used to build websites and online applications. It provides a user-friendly interface that allows users to manage content without coding knowledge. Features of Joomla Easy to Customize ... Read More

Represent Python Tuple in JSON Format

Sindhura Repala
Updated on 17-Apr-2025 11:23:57

28K+ Views

In this article, we will demonstrate how to represent a tuple in Python using JSON format. We will explore the following methods throughout the article: Converting Python Tuple to JSON Converting Python Tuple with Different Datatypes to JSON String Parsing JSON string and accessing elements using json.loads() method. ... Read More

Remove Items from a Python Tuple

Sindhura Repala
Updated on 17-Apr-2025 11:06:57

2K+ Views

A tuple in Python is an ordered, immutable collection that holds multiple items, supports mixed data types, and allows indexing. Since tuples cannot be modified, index slicing can exclude specific elements when needed. Conversion to a List Applying Tuple Conversion Slicing Conversion to a ... Read More

Create Python Tuple of Unicode Strings

Sindhura Repala
Updated on 17-Apr-2025 11:06:46

414 Views

A tuple in Python is an ordered, immutable collection that stores multiple items. It supports mixed data types, allows indexing, and is commonly used for fixed data structures. Unicode String A Unicode string in Python tuple refers to a tuple containing Unicode string values or a string that includes a tuple with Unicode characters. Tuple with Unicode string Unicode string representing a tuple ... Read More

Create a Non-Literal Python Tuple

Sindhura Repala
Updated on 17-Apr-2025 11:06:09

416 Views

A tuple in Python is an ordered, immutable collection that stores multiple items. It supports mixed data types, allows indexing, and is commonly used for fixed data structures. Non-literal Tuple Literal Tuple Non-Literal Tuple A non-literal tuple in Python is created dynamically using code instead of being written directly with parentheses and values like (2, 4, 6). # From a list data = [2, 4, 6] t = tuple(data) print(t) # From a generator t = tuple(i for i in range(3)) # ... Read More

Iterate TreeMap in Reverse Order in Java

Shriansh Kumar
Updated on 17-Apr-2025 10:48:26

2K+ Views

The TreeMap is a class of Java Collection Framework that implements NavigableMap Interface. It stores the elements of the map in a tree structure and provides an efficient alternative to store the key-value pairs in sorted order. In other words, it always returns the elements in ascending order. However, Java provides a few ways to iterate through the TreeMap in descending order. In this article, we are going to explore the ways of iterating TreeMap in Reverse order. How to Iterate TreeMap in Reverse Order? In Java, we can use the following ways to print elements of TreeMap in reverse ... Read More

Advertisements