COMPUTER PROGRAMMING FUNDAMENTALS
WHAT IS PROGRAMMING
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
If string ____ name=‘Programming techniques’. What is the output of print(len(string ____ name))?
|
20
|
|
21
|
|
22
|
|
23
|
Explanation:
Detailed explanation-1: -The len() function returns the number of items in an object. When the object is a string, the len() function returns the number of characters in the string.
Detailed explanation-2: -The Python String len() method is used to retrieve the length of the string. A string is a collection of characters and the length of a string is the number of characters (Unicode values) in it.
Detailed explanation-3: -To use the len() function to get the length of a data type, assign the data type to a variable, then pass the variable name to the len() function.
Detailed explanation-4: -As you know, the best way to find the length of a string is by using the strlen() function.
There is 1 question to complete.