Single program in multiple data to print the list data structure program in python. This program can print a different set of data types. In this program, we can use different set programs in a single data type in python programming language.
Different kinds can be found in a Python list! Within a single list, you may store a number, a text, and even another list. The slicing operator may also be used to access a range of items in a list.
list1 = ["welcome", "to", "inlarn"]
list2 = [5, 50, 500,5000,50000]
[‘welcome’, ‘to’, ‘inlarn’] [5, 50, 500, 5000, 50000]
How to use different data types in multiple list in python data strutures
Because it is the base of all classes, you may use it to store any sort of value, such as int, float, String, class objects, or any other java objects. For example, consider the main function code, which generates a new person object with int, float, and string types, then adds it to the List and iterates it using the for loop.
There are no inherent issues with a list containing various data types. Of course, if you try to use that list for something that needs all of the items to be of the same kind, you’ll run into issues. If this is all you’re doing with it, there’s no way it can become an issue in your case.