Which function returns the character length of a string?

lower()

len()

The function that returns the character length of a string is the len() function. This function is designed to take a string as an argument and return the number of characters contained within that string. This includes all characters — letters, digits, spaces, and punctuation marks.

For example, if you have a string "Hello, World!" and you apply the len() function to it, it will return 13, as that is the total number of characters in the string.

In contrast, the other functions listed have different purposes. The lower() function is used to convert all characters in a string to lowercase, which does not pertain to determining character length. The ltrim() function removes any leading whitespace characters from a string, again focusing on content alteration rather than measuring length. The substr() function is utilized to extract a substring from a given string based on specified starting position and length, and does not provide the total character count of the entire string. Thus, len() is the appropriate choice for returning the character length.

Get further explanation with Examzify DeepDiveBeta

ltrim()

substr()

Want more questions?

All options are one-time payments.

$12.99

30 day pass for new members

All the basics to get you started

  • Ad-free experience
  • View your previous attempt history
  • Mobile app access
  • In-depth explanations
  • 30 day premium pass access
$29.99 $92.93 usd

6 month DELUXE pass (most popular)

Everything with the 30 day premium pass FOR 6 MONTHS! & the ultimate digital PDF study guide (BONUS)

  • Everything included in the premium pass
  • $92.93 usd value for $29.99! You save $62.94!
  • + Access to the ultimate digital PDF study guide
  • + 6 months of premium pass access
  • + Priority support
$14.99 $19.99

Ultimate digital PDF study guide

For those that prefer a more traditional form of learning

  • Available for instant download
  • Available offline
  • Hundreds of practice multiple choice questions
  • Comprehensive content
  • Detailed explanations
Image Description
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy