English subtitles

← Split - Programming Languages

Get Embed Code
6 Languages

Showing Revision 3 created 05/24/2016 by Udacity Robot.

  1. Splitting up words by spaces is such a common task in computer science
  2. that Python has a built-in function, string.split(), that does just that.
  3. For example, suppose we take one of Charlotte Bronte's books as a string
  4. and we call split on it.
  5. We'll get out a list where each element of the list corresponds
  6. to one of the words in this string separated by spaces.
  7. This space here leads us directly to this comma, separating these list elements.
  8. Let's take a moment now to get a little more practice with this new approach
  9. to splitting by whitespace.
  10. Whitespace is just a more formal name for some series of spaces or tabs.
  11. Here I've written three Python expressions, each one of which is a constant string.
  12. We're calling split on it.
  13. I'd like you to fill in each box with the number of elements in the list returned
  14. by the split expression.
  15. You can use the interpreter if you like, but try to reason it out no your own.