input is the opposite of
>>> number = input("Enter your favorite number: ") Enter your favorite number: 666 >>> print(number) 666 >>> quest = input('What is your quest? ') What is your quest? To seek the holy grail! >>> print(quest) To seek the holy grail!
After the user presses Enter,
input will return whatever the user typed.
input might seem a little pointless right now. In the example above,
you could have simply typed
number = 666 instead of
input("Enter your favorite number: "). The purpose of using
in this interactive mode is so you can learn how it works. In the next
section, you will save a few commands in a file so that you can run
them non-interactively. That’s when
input becomes useful.