Return to Video

Is It Perfect Solution - Software Debugging

  • 0:00 - 0:06
    If you remember our program works going through the individual states of the finite state machine,
  • 0:06 - 0:10
    you will find that this input is not processed correctly.
  • 0:10 - 0:15
    What we have in here in our input is the character that can also be mistaken
  • 0:15 - 0:17
    for the end of tag in HTML markup.
  • 0:17 - 0:22
    A program does not know about the special meaning of double quotes, so what it does is--
  • 0:22 - 0:28
    it starts interpreting everything as HTML but only up to the closing tag.
  • 0:28 - 0:32
    The double quote in here is interpreted as text input.
  • 0:32 - 0:37
    The greater than sign is ignored even in a non-tag mode. The text is doing just fine.
  • 0:37 - 0:39
    And the remaining HTML markup is ignored.
  • 0:39 - 0:44
    So what we should get as output is double quote foo and you can see that the output
  • 0:44 - 0:47
    still contains part of the original HTML markup.
  • 0:47 - 0:53
    So this is the correct answer. The others all work fine. Let me demonstrate this in the IDE.
  • 0:53 - 0:58
    Since I'm now having double quotes in my script, I use single quotes in Python,
  • 0:58 - 1:01
    which I can also use to delimit a string.
  • 1:01 - 1:06
    Rule of thumb--if your string contains double quotes, use single quotes as string delimiters.
  • 1:06 - 1:10
    If your string contains single quotes, use double quotes as delimiters.
  • 1:10 - 1:13
    If there's no quotes in your string, well feel free whatever you like.
  • 1:13 - 1:17
    Here's our input with greater than and double quotes, we run the whole thing,
  • 1:17 - 1:22
    and we see that the output indeed contains part of the HTML markup
  • 1:22 - 1:24
    that is the double quote is still in there.
Title:
Is It Perfect Solution - Software Debugging
Video Language:
English
Team:
Udacity
Project:
CS259 - Software Debugging
Duration:
01:26
Udacity Robot edited English subtitles for Is It Perfect Solution - Software Debugging
Fran Ontanaya edited English subtitles for Is It Perfect Solution - Software Debugging
Amara Bot added a translation

English subtitles

Revisions Compare revisions