Mark As Completed Discussion

Text Data

The type string represents text data. Most text data contains alphabetical and alphanumeric information. Anything enclosed in ' ' or " " is a string. It can be any number, word, sentence, or special character. Let's see it in action:

PYTHON
1string1 = "Minahil"
2string2 = 'Minahil123'
3string3 = 'Min@hi!'

Now, if we check the data types using type() function:

PYTHON
1print(type(string1))
2print(type(string2))
3print(type(string3))

The output will be:

PYTHON
1<class 'str'>
2<class 'str'>
3<class 'str'>
PYTHON
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment