what are the similarities between strings and lists
Answers
Answered by
19
Explanation:
Strings and lists are similar, but they are not same and many people don't know the main difference between a string and a list in python. One simple difference between strings and lists is that lists can any type of data i.e. integers, characters, strings etc, while strings can only hold a set of characters.
Answered by
1
QUESTION:-
What are the similarities between strings and lists
ANSWER:-
A List is an organized sequence of object types and a String is an ordered sequence of characters
The Similarities Between Strings And Lists Are:-
- The main similarity between Strings and List is that in Python both are sequences. A string is a character's sequence between single or double quotations. A list is an item sequence in which each item could be anything such as a float, an integer, a string, etc
- The second similarity between Strings and Lists is that both strings and lists have lengths. A length of a string is the number of characters in the string and a length of a list is the number of items in the list.
- The third similarity between Strings and Lists is that both strings and lists have a position. Every character in a string as well as every item in a list has a position which is known as an index.
#SPJ3
Similar questions