English subtitles

← Testing2 - Intro to Computer Science

Get Embed Code
3 Languages

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

  1. So here's a more challenging quiz about find. This one will require you
  2. to think pretty carefully about how find is defined. For any string, so
  3. we're going to have a variable s that we've initialized to any string. Your
  4. goal is to determine which of these will always have the value zero.
  5. So the first choice, s.find (s). Notice there are no quotes around s. The
  6. second one is s.find('s'). The third one is
  7. 's'.find('s'). The fourth one is
  8. s.find(''). And the final
  9. one is s.find Passing
  10. in s concatenated with the string. Three exclamation points, one of my favorites
  11. plus one. So check all of the answers where the expression here
  12. evaluates to zero, no matter what value the string s starts with. So try
  13. to answer this, just based on thinking, understanding the description of find.
  14. You can always also try things in the Python interpreter
  15. after that. And see if your interpretation is correct. But remember
  16. our goal is to answer the question where no matter
  17. what the string S is, the resultive expression is always zero.