Intern
196
How to count the length of a string in Python?
Answer from AI
sobes.tech AI
Use the built-in len() function.
# Assign a string to a variable
my_string = "Hello, World!"
# Calculate the length of the string
string_length = len(my_string)
# string_length will be 13