How do I make the whole string a list element?
In this topic, we will discuss how to convert the whole string into a list element Python.
what is a list: A list is used to store multiple items in a single variable. in the list, the elements are present inside the square brackets.
Syntax: list = [“shubham”,”avanish”,” Ashish”]
What is a string: A string is a sequence of characters.
A string in python is surrounded by either a single quote or double quote
Syntax : str = “this is shubham” or ‘ this is shubham ’
To Make the whole string a list element :
you can easily convert the string into a list. let see an example of it how can we make the whole string a list element.
The output of the following code is :
Comments
Post a Comment