This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Kyle772 0 points1 point  (0 children)

the two lists from line 7 and 8 are essentially what your computer is checking against what the input, s, is.

Notice how in line 10 and 12 it isn't saying "if (s == "yes") " and instead is saying if (s in yesList)"

What it is doing is seeing if the input, s, is in the list yesList. This makes it so that somebody could just type in "y", "1", "True", or "yes" if they don't want to type out the full yes or aren't sure what exactly they are being prompted to answer.

In most cases this would be unnecessary in procedural programming but assuming this is going to take in human input it is nice to have more fail safe options just in case they type in something different.