CHAPTER SIX PYTHON ON WINDOWS FAQ 6.1 How do I run a Python program under Windows? 67 Many people use the interactive mode as a convenient yet highly programmable calculator. When you want to end your interactive Python session, call the$_{exit()}$ function or hold the$_{Ctrl}$key down while you enter a$_{Z}$ , then hit the “$_{Enter}$” key to get back to your Windows command prompt. You have started the interpreter in “interactive mode”. That means you can enter Python statements or expressions interactively and have them executed or evaluated while you wait. This is one of Python’s strongest features. Check it by entering a few expressions of your choice and seeing the results: You should then see something like: C:\Users\YourName> py First, you need to make sure that your command window recognises the word “py” as an instruction to start the interpreter. If you have opened a command window, you should try entering the command$_{py}$and hitting return: You need to realize that your Python scripts have to be processed by another program called the Python interpreter . The interpreter reads your script, compiles it into bytecodes, and then executes the bytecodes to run your program. So, how do you arrange for the interpreter to handle your Python? depending on how your computer has been set up and what else you have recently done with it. Once you have started such a window, you are well on the way to running Python programs. D:\YourName\Projects\Python> The letter may be different, and there might be other things after it, so you might just as easily see something like: C:\> Unless you use some sort of integrated development environment, you will end up typing Windows commands into what is variously referred to as a “DOS window” or “Command prompt window”. Usually you can create such a window from your search bar by searching for cmd . You should be able to recognize when you have started such a window because you will see a Windows “command prompt”, which usually looks like this: This is not necessarily a straightforward question. If you are already familiar with running programs from the Win- dows command line then everything will seem obvious; otherwise, you might need a little more guidance. Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC ␣ ↪ → on win32 Type "help", "copyright", "credits" or "license" for more information. >>> >>> print("Hello") Hello >>> "Hello"*3 'HelloHelloHello'