Sindhura Repala

Sindhura Repala

28 Articles Published

Articles by Sindhura Repala

Page 2 of 3

How can I define duplicate items in a Python tuple?

Sindhura Repala
Sindhura Repala
Updated on 24-Mar-2026 1K+ Views

Python tuples are ordered collections that allow duplicate elements, making them perfect for storing repeated values. Unlike sets which only store unique items, tuples preserve all elements including duplicates. What is Python Tuple? A tuple in Python is an ordered collection of items that cannot be changed once created, making it immutable. This allows duplicate values and can hold elements of different data types, such as strings, numbers, other tuples, and more. This makes tuples useful for grouping related data while ensuring the content remains fixed and unchanged. Example This code demonstrates different types of tuples ...

Read More

How to convert python tuple into a two-dimensional table?

Sindhura Repala
Sindhura Repala
Updated on 24-Mar-2026 2K+ Views

A tuple in Python is an ordered, immutable collection that stores multiple items. Converting tuples into two-dimensional tables helps organize data in a structured, tabular format for better analysis and visualization. What is a Two-Dimensional Table? A two-dimensional table is a data structure organized in rows and columns, similar to a spreadsheet. Each row represents a record, and each column represents a specific property or field. Example Table Structure NAME AGE CITY Ramesh 32 Hyderabad Suresh 42 Bangalore Rajesh 52 Chennai Here's how to create ...

Read More

How can I represent python tuple in JSON format?

Sindhura Repala
Sindhura Repala
Updated on 24-Mar-2026 28K+ Views

Python tuples can be represented in JSON format as arrays. Since JSON doesn't have a native tuple type, Python's json module automatically converts tuples to JSON arrays, preserving the data while changing the structure slightly. What is JSON? JSON (JavaScript Object Notation) is a lightweight, human-readable data interchange format. While derived from JavaScript, it works as a language-independent text format compatible with Python and many other programming languages. JSON facilitates data exchange between servers and web applications. JSON is composed of two main structures: Name/value pairs (like objects or dictionaries) Ordered collections of values (like ...

Read More

How can I remove items out of a Python tuple?

Sindhura Repala
Sindhura Repala
Updated on 24-Mar-2026 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 directly, we need special techniques to remove items from them. Here are three main approaches to remove items from a Python tuple: Converting to List and Back Using Tuple Comprehension ...

Read More

How can I create a Python tuple of Unicode strings?

Sindhura Repala
Sindhura Repala
Updated on 24-Mar-2026 500 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. In Python 3, all strings are Unicode by default, making it straightforward to create tuples containing Unicode strings. Creating Basic Unicode String Tuples You can create a tuple with Unicode strings by simply placing Unicode text inside tuple parentheses. Python 3 handles Unicode automatically ? # Basic Unicode tuple unicode_tuple = ('café', 'naïve', '世界', '😊') print(unicode_tuple) print(type(unicode_tuple)) ('café', 'naïve', '世界', '😊') Using ...

Read More

How can I create a non-literal python tuple?

Sindhura Repala
Sindhura Repala
Updated on 24-Mar-2026 477 Views

A tuple in Python is an ordered, immutable collection that stores multiple items. Tuples can be created in two ways: directly with fixed values (literal) or dynamically using code (non-literal). Literal Tuple − Created directly with parentheses: (1, 2, 3) Non-literal Tuple − Created dynamically using functions or expressions What is a Non-Literal Tuple? A non-literal tuple is created dynamically using code instead of being written directly with parentheses and values. It's formed through functions, expressions, or data transformations. Method 1: Using tuple() Constructor Convert existing data structures into tuples ? ...

Read More

How can I represent immutable vectors in Python?

Sindhura Repala
Sindhura Repala
Updated on 24-Mar-2026 445 Views

An immutable vector in Python is a fixed, ordered collection of numerical values that cannot be changed after creation. These are implemented using tuples or libraries like NumPy with write protection, ensuring data consistency and preventing modifications during computations. Methods to Represent Immutable Vectors Python provides several approaches to create immutable vectors ? Using Tuples Using NumPy Arrays with Write Protection Using Named Tuples Using Tuples Tuples are inherently immutable in Python, making them ideal for representing fixed vectors ? ...

Read More

How to add a list item in HTML?

Sindhura Repala
Sindhura Repala
Updated on 16-Mar-2026 2K+ Views

To add a list item in HTML, use the tag. It can be used inside ordered lists (), unordered lists (), and menu lists (). In an ordered list, the list items are displayed with numbers or letters. In an unordered list and menu list, the list items are displayed with bullet points. Syntax Following is the syntax for the list item tag in HTML − Content The tag must be placed inside a list container like , , or . Attributes The tag supports the following specific attributes ...

Read More

How to display a summary for a given in HTML5?

Sindhura Repala
Sindhura Repala
Updated on 16-Mar-2026 425 Views

The tag in HTML5 provides a visible heading for the element. When users click the summary heading, it toggles the visibility of the additional content inside the details element, creating an interactive collapsible section. The tag must be the first child element of the tag. If no summary is provided, the browser displays a default disclosure triangle or "Details" text. Syntax Following is the syntax for using the element − Heading text The tag supports all global attributes ...

Read More

Differentiate between int main and int main(void) function in C

Sindhura Repala
Sindhura Repala
Updated on 15-Mar-2026 16K+ Views

In C programming, there is a subtle but important difference between int main() and int main(void). Both declare the main function to return an integer, but they differ in how they handle function parameters. Syntax int main() { // Function body return 0; } int main(void) { // Function body return 0; } The int main() Function The int main() function with empty parentheses indicates that the function can accept any number of arguments. In C, when ...

Read More
Showing 11–20 of 28 articles
Advertisements