string = "Hello World" len(string) # number of characters in string print(len(string) result: 11
Here is what the above code is Doing:
1. We create a variable called string and set it equal to “Hello World”.
2. We use the len() function to get the length of the string.
3. We print the length of the string to the console.