Definition:
If you need to store various types of data in a list, you can create a mixed list.
Now you will clearly understand this with the help of the diagram.
a = [5, "mixed-list", 3.5] ┌──────────────┬────────────────┬──────────────┐ Index → │ 0 │ 1 │ 2 │ ├──────────────┼────────────────┼──────────────┤ Value → │ 5 │ "mixed-list" │ 3.5 │ └──────────────┴────────────────┴──────────────┘
Syntax:
list_name = [value1, value2, value3]
Example:
a = [5, "mixed-list", 3.5]
print(a)
Output:
Exercise
Create a mixed list with values 10, "hello", 2.5 and print it using Python.
