Python comes with lots of modules and packages that you can import to add new features. Now we’ll spend a little time looking at IDLE’s other useful features. The code editor screen looks a little different than the IDLE screenshot above: The primary benefit of using the Python shell is that you can experiment with small snippets to see how your code will behave before you put the code into a real program. Now you can type in your program and save it here. If you want to save your code into a file, go to the File menu and choose New Window (or press CTRL+N). You will learn what functions are in chapter 10. In Python 3, the print statement was turned into a print function, which is why parentheses are required. Type the following after the command prompt (>) in IDLE: There is no compiling of the code as Python is an interpretive language and runs in the Python interpreter. Yes, it’s a Python shell where you can type short scripts and see their output immediately and even interact with code in real time. To open up IDLE, you will need to find it and you’ll see something like this: You might also like to know that IDLE was created using Tkinter, a Python GUI toolkit that comes with Python. The reason I call it “lite” is the debugger is very basic and it’s missing other features that programmers who have a background using products like Visual Studio will miss. It allows the programmer to write Python and debug their code quite easily. IDLE is kind of a lite IDE, but it does have all those items mentioned. You can find an IDE for most popular languages and a number of IDEs will work with multiple languages. An IDE is an editor for programmers that provides color highlighting of key words in the language, auto-complete, an “experimental” debugger and lots of other fun things. There is some lore that the name for IDLE comes from Eric Idle, an actor in Monty Python. Python comes with its own code editor: IDLE (Integrated Development and Learning Environment).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |