A python code can be run using multiple interfaces. Using CMD for this purpose is one of the easy and efficient ways.
In order to run a python program in CMD, first of all open the CMD or terminal and then type python and then hit enter.
Now you can write and run any python code as you wish.
To exit the interactive mode, use can use quit() or exit(). The drawback of using this method is that once you close the CMD, the code is lost. You cannot retrieve it later.