Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (55.6k points)

Can anyone tell me what is the name of the data type for character in python?

1 Answer

0 votes
by (119k points)

In Python, str is the datatype for characters or Unicode characters. The string is initialized with the set of characters in between single-quotes or double-quotes.

Examples:

firstName = 'john'

lastName = 'cena'

print('The datatype of firstName is: ', type(firstName))

print('The datatype of lastName is: ', type(lastName))

output:

The datatype of firstName is:  <class 'str'>

The datatype of lastName is:  <class 'str'>

You can check out this Python Tutorial by Intellipaat to understand in-detail about Datatypes in Python.

Also, watch this video on Python data types:

Related questions

0 votes
1 answer
asked Dec 19, 2020 in Python by ashely (50.2k points)
0 votes
0 answers
0 votes
1 answer

Browse Categories

...