Bite-Size Python: An Introduction to Python Programming
(as of Aug 02,2022 15:13:07 UTC – Details)
From the Publisher
What is an IDE?
When you code in Python, you have to write and run your code in a program that can read and run Python. For this exercise, we’ll be using an integrated development environment (IDE). An IDE is a powerful program that combines a variety of useful coding tools into a single tool to help you code more efficiently!
Although there are many IDEs on the internet available to download, we’ll be using an IDE that comes installed with Python; it is name IDLE.
Let’s Take IDLE Out for a Spin!
What is IDLE?
You can write and run Python code in an IDE that comes installed with Python named IDLE. You can use IDLE on both Windows and Unix platforms as the IDE works mostly the same across each platform.
IDLE is equipped with some useful features to help you out as you code. While these features may not mean much to you now, you’ll learn more about their magic as you develop your Python skills.
Syntax highlighting to your code Auto completion Multiwindow text editor Smart indent Call tips Command history
Python Version: The version of Python displays at the top of the window in IDLE.
Python Shell Window: Here is where you will type, read, and run your Python code. The Python Shell window is also called an interpreter.
Text Cursor: The text cursor will let you know if it’s okay to enter a new command line or line of code into the interpreter by blinking repeatedly. If the text cursor isn’t blinking, there’s a good chance that your computer isn’t done completing the command you asked the computer to complete. Just give IDLE a moment to finish completing your prior command before beginning to type.
IDLE Menus: There are lots of options available in the IDLE menus. As you work through the exercises in this book, you will notice that the menus in IDLE will change. IDLE has both a Shell window and an Editor window. Depending on the window type that you’re using, the menu options will change.
Run Code in IDLE
Let’s give IDLE a test run! First, check to make sure that your text cursor is blinking. If your text cursor is blinking, type print(‘Hello World!’) into the interpreter and press Enter.
Congratulations! You just wrote and ran your first line of Python code! So, what exactly happened? The code you entered tells Python to print the text inside the quotes. Try writing another line of code using the same code as before; however, replace Hello World! with another phrase. Be sure to keep the quotes surrounding the phrase; otherwise, the interpreter will return an error after you press Enter.
There are two important things to remember about running Python code. First, Python code is run from top to bottom. What this means is that the code that appears at the top of the program is run first and the final line of code is run last. Second, Python relies on proper indentation. Fortunately, IDLE automatically includes indentation for you.
Publisher : Wiley; 1st edition (September 1, 2020)
Language : English
Paperback : 240 pages
ISBN-10 : 1119643813
ISBN-13 : 978-1119643814
Reading age : 9 – 12 years
Grade level : 4 – 6
Item Weight : 1.09 pounds
Dimensions : 7.3 x 0.5 x 9.2 inches