What is string in Python and how can we access values in list.
Answers
Answered by
0
Answer:
We can also use count() function to get the number of occurrences of a string in the list. If its output is 0, then it means that string is not present in the list. l1 = ['A', 'B', 'C', 'D', 'A', 'A', 'C'] s = 'A' count = l1. count(s) if count > 0: print(f'{s} is present in the list for {count} times.
Mark me as BRAINLIEST
Answered by
0
Strings in python:
• In Python, Strings are arrays of bytes signifying Unicode characters. However, Python does not have a character data form, a single character is merely a string with a length of 1.
• Square brackets can be used to access the values of the string.
• We can access values in a string list by using square brackets
Hope it helped..
Similar questions
Social Sciences,
5 months ago
Political Science,
5 months ago
Computer Science,
11 months ago
Computer Science,
11 months ago
Science,
1 year ago