Measuring String Length

  • The len() function in Python allows us to find the length of a string
  • Use .length in JavaScript to do this as well
print(len("Hello"))
5
  • Use Case: Determine number of characters in string (eg for validation of password length)
%%js
console.log("Hello".length);
<IPython.core.display.Javascript object>