PyCharm runs the code files with the py extension. This tutorial explains how to run Python code using the command line shortcut and UI.
ShortCut code to run file code in PyCharm
Windows : Ctrl + Shift + F10 or Shift + F10 Mac : ⌃ + ⇧+ R
Another way
- Open python file
- Right-click on python code editor
- It shows the popup and selects Run ‘main’ option, where ‘main’ is the name of the file