To use the Python interpreter, follow these steps:
-
Open Terminal: Launch your terminal or command prompt.
-
Start the Interpreter: Type
python3(or justpythondepending on your setup) and press Enter. You should see a prompt like this:Python 3.x.x (default, Mon DD YYYY, HH:MM:SS) [GCC x.x.x] on linux Type "help", "copyright", "credits" or "license" for more information. >>> -
Enter Commands: At the
>>>prompt, you can type Python commands. For example:print("Hello, World!")Press Enter to execute the command.
-
Exit the Interpreter: To exit, type
exit()or pressCtrl + D(on Unix) orCtrl + Zfollowed by Enter (on Windows).
Example Session
>>> print("Hello, World!")
Hello, World!
>>> 2 + 2
4
>>> exit()
Feel free to ask if you have more questions about using the interpreter!
