
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

6K+ Views
Tuples are compared position by position: the first item of the first tuple is compared to the first item of the second tuple; if they are not equal, this is the result of the comparison, else the second item is considered, then the third and so on. example>>> a = (1, 2, 3) >>> b = (1, 2, 5) >>> a < b TrueThere is another type of comparison that takes into account similar and different elements. This can be performed using sets. Sets will take the tuples and take only unique values. Then you can perform a & operation that ... Read More

10K+ Views
In this article, we will show you how to convert a Python tuple to a C array. Python does not have a built-in array data type like other programming languages, but you can create an array using a library like Numpy. Tuple to Array Conversion Using Python The Python NumPy library provides various methods to create manipulate and modify arrays in Python Following are the two important methods that helps us to convert a tuple into an array − Using numpy.asarray() method Use numpy.array() method If you haven't already installed NumPy on your system, run the following ... Read More

494 Views
In Python, especially in situations like iterating through data structures, working with built-in functions, or fetching records from a database, lists of tuples are returned by the pre-defined functions instead of a list of lists. This is because tuples are immutable i.e., we cannot modify them after creation, whereas lists are mutable; once obtained, we can change their contents. This makes tuples ideal for storing fixed data like database records or function results, ensuring data integrity. Let us see methods/functions in Python that return a list of tuples - The enumerate() Function The enumerate() function is used to add a counter to ... Read More

408 Views
There is no concept of a tuple in the JSON format. Python's JSON module converts Python tuples to JSON lists because that's the closest thing in JSON to a tuple. Immutability will not be preserved. If you want to preserve them, use a utility like a pickle or write your own encoders and decoders.If you're using pickle, it won't store the Python temples in JSON files but in pkl files. This isn't useful if you're sending data across the web. The best way is to use your own encoders and decoders that will differentiate between lists and tuples depending on ... Read More

1K+ Views
In Python, a list is a mutable data type used to store a collection of items, which are separated by commas and enclosed within square brackets [ ]. According to the Python documentation, there is no concept of a homogeneous list in Python. However, a Python list can contain collections of homogeneous items, meaning that the data types of the items are the same. Python List of Homogeneous Data A Python list can contain both homogeneous and heterogeneous data. Example Here is an example of a list containing homogeneous data - # List containing ... Read More

11K+ Views
In this article, we will show you how to convert bytes into a string in Python. Strings are sequences of characters, while bytes are 8-bit values. To convert a sequence of characters to 8-bit values, we can utilize Python's built-in methods, which we will explore in this article. Converting Bytes to Strings in Python The following methods can be efficiently used to convert bytes to Python string. Using decode() function Using str() function Using codecs.decode() function Using pandas library ... Read More

417 Views
the main() method in Java code is itself inside a class. The static keyword lets the main() method which is the entry point of execution without making an object but you need to write a class. In C++, main() is outside the class and writing class it self is not mandatory. Hence, C++ is not a pure object oriented language bu Java is a completely object oriented language.