Account
Categories

String List


Definition:

If you are required to store the data of strings in the form of a list, then you can create a string list.

Now you will clearly understand this with the help of the diagram.

a = ["grapes", "papaya", "mango"]

        ┌─────────┬─────────┬────────┐
Index → │ 012      │
        ├─────────┼─────────┼────────┤
Value → │ grapespapayamango  │
        └─────────┴─────────┴────────┘

Syntax:

list_name = ["str1", "str2", "str3"]

Example:

a = ["grapes", "papaya", "mango"]
print(a)

Output:

Exercise

Create a string list with values "apple", "banana", "orange" and print it using Python.