Chapter 3: Running Python

Running Python interactively

face Josiah Wang

Python is (sort of) an interpreted language.

As a result, you can also run Python interactively.

Type python (or python3 or python3.12 depending on your setup) into the command line.

$ python3
Python 3.12.4 (main, Nov  2 2022, 18:53:38) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

You should get an interactive prompt, which you can now use to type Python code interactively. Make sure you are using the correct version!

Now, type these into the Python prompt:

>>> 1+1
2
>>> "I am a genius"
'I am a genius'

Yes, you are indeed a genius! 😃

Finally, type exit() or quit() or Ctrl+D to exit the prompt.