Press the Return or Enter key

When you press Return, Python interprets your input and responds if what you typed calls for a response or if the interpreter doesn't understand what you typed.

In the following example, the statement tells Python to print a string. Because the statement doesn't specify where to print the string, Python prints it to the screen (the default behavior in interactive mode).

>>> print "Hello, World!" Hello, World!

This statement is a whole Python program! Pretty simple, eh? When you use interactive mode, Python processes each line of code you type as soon as you press Return (unless it sees that you are writing a multiline chunk of code), and the results appear underneath.

Was this article helpful?

0 0

Post a comment