13.2. Interactive Stories with Input

You can use if statements to make a story interactive where the reader picks from several possible next actions. The input method will display the string and return what the user types. You can check if two strings have the same characters using == in Python.

What should the program do if the user enters something besides in, left, or right? Fix the code above to let the user know what went wrong. Also add another possibility like “out”.

Note

Discuss topics in this section with classmates.

Show Comments
You have attempted of activities on this page