Back Navigation Next Navigation Conceptual Review (page 8 of 55)

How do we execute code in Pycharm?

To submit a specific segment of the script to the interpreter, do the following:

1. Highlight the lines of code that you want to execute.
2. Use the ALT+SHIFT+E (or CMD+SHIFT+E on a MAC) keyboard shortcut. Running code in this manner is referred to as running code interactively. It is convenient, but it is a bit slower than submitting the entire script to the interpreter at once. Instead of using the keyboard shortcut, you can right-click and select the "Execute Line in Python Console" option.

To execute your entire script, do the following:

1. Use the SHIFT+F10 keys on your keyboard. SHIFT+F10 is faster than ALT+SHIFT+E, but the tradeoff is that we lose a bit of flexibility.