Return to site

Exedore 0 8 2 – Mac Native Python Ide

broken image


  1. Exedore 0 8 2 – Mac Native Python Identification
  2. Exedore 0 8 2 – Mac Native Python Ide 8.2
  1. Repl.it is the world-leading online coding platform where you can collaborate, compile, run, share, and deploy Python online. Code in 50+ programming languages and frameworks!
  2. Python 2.0.1 June 22, 2001 Download Release Notes; View older releases. The same source code archive can also be used to build the Windows and Mac versions, and is the starting point for ports to all other platforms. Download the latest Python 3 and Python 2 source.

Using IDLE (Python's IDE)
Last Revision: July, 2010
( McCann )
Mac

VS code is not a native app. PyCharm IDE for python. It is one of the most used and featured IDE for Python users that is available free and in paid versions. PyCharm can be easily installed by Windows, Linux or MacOS X. Python development is directly supported by PyCharm. The code can be run and debugged directly from within the platform.

The intended audience for this document is the Fall 2010 ISTA 130 class at theUniversity of Arizona. If other people also find it helpful, great!

Exedore 0 8 2 – Mac Native Python Identification

Outline

Exedore 0 8 2 – Mac Native Python Ide 8.2

  1. Using the Python Shell Window
Exedore 0 8 2 – Mac Native Python Ide

VS code is not a native app. PyCharm IDE for python. It is one of the most used and featured IDE for Python users that is available free and in paid versions. PyCharm can be easily installed by Windows, Linux or MacOS X. Python development is directly supported by PyCharm. The code can be run and debugged directly from within the platform.

The intended audience for this document is the Fall 2010 ISTA 130 class at theUniversity of Arizona. If other people also find it helpful, great!

Exedore 0 8 2 – Mac Native Python Identification

Outline

Exedore 0 8 2 – Mac Native Python Ide 8.2

  1. Using the Python Shell Window
  1. What is IDLE?

    IDLE is the integrated development environment (IDE) provided with Python. An IDE combines a program editor and a language environment as a convenience to the programmer. Using IDLE is not a requirement for using Python. There are many other IDEs that can be used to write Python programs, not to mention a variety of text-based programmer's editors that many programmers prefer to IDEs.

    We are covering IDLE because it comes with Python, and because it is not too complex for beginning programmers to use effectively. You are welcome to use another editor or IDE if you wish, but if you don't already know one, IDLE is a good choice.

  2. Launching IDLE

    If you are reading this, you have probably already installed Python and IDLE. If not, now would be a good time to do so. We have a short web page with installation instructions: Installing Python.

    With Python and IDLE installed, IDLE can be launched from your OS's program collection. For example, here's where you might find it if you using Ubuntu Linux with Gnome:

    Clicking on the IDLE selection will launch IDLE and display the Python Shell window.

  3. Using the Python Shell Window

    The top of IDLE's Python Shell window will look something like this:

    This window serves two main purposes: To let us experiment with Python commands, and to let us open a program editing window.

    1. Experimenting with Python Commands

      Python, by design, is an interpreted language (as opposed to a compiled language). Programs written with interpreted languages do tend to execute a little more slowly than do compiled programs, but for most tasks the difference is insignificant. The big advantage of an interpreted language is experimentation: A programmer can try out algorithms and play around with different commands interactively (that is, without having to write a complete program to do either). For people just starting to learn programming in general, or Python in particular, interactive experimentation is very useful.

      This interactivity is the main purpose of the IDLE's Python Shell window. You probably noticed already that the last line of text in the window is the set of three 'greater-than' symbols. This is the prompt symbol; when you see it on a line by itself, Python is waiting for you to do something -- such as type in a command.

      Let's give it a try. Click on the Python Shell window (to make sure that it has the keyboard's attention) and then type this line, just like you see it:

      As you are typing, you'll probably be distracted by a little pop-up message that shows the basic structure of an invocation of the print function. Just ignore it. You'll also notice that parts of the line you're typing appear in different colors. That's also not important right now.

      When you're done typing, press the ENTER key. You should see the following in the window (minus all the colors):

      Not terribly exciting, of course, but useful: If you were able to execute that print, you can execute all sort of other Python commands and see what they do. As an example of something more complex, let's get Python to display the odd integers from -9 through 9. Now, here's what we will be typing, but please don't do it yet:

      Notice that this example is on two lines, and that the second is indented by four spaces. You will have to tell IDLE to go to the second line (by pressing the ENTER key after you type the colon), but IDLE will take care of the indenting for you. When you get to the end of the second line, press the ENTER key twice. Got it? Great; go ahead and type it in. After pressing the ENTER key twice at the end, here's what you should see:

      The intentation is a big deal to Python; that's how it knows that the second line is actually a component of the for statement that was started in the first line.

      That's all we want to do with experimentation for now. We're sure that you have several questions (e.g., 'Why does the range go to 10 but the numbers stopped at 9?'), and that's good. We'll be covering the for statement in class in detail. In the meantime, you can consult the text for answers to such questions.

    2. Creating and Executing a Python Program

      Playing around with Python commands in the shell window is nice, but our goal is to write complete Python programs. To do that, we need to start IDLE's editor. Here's how: From the Python Shell window, click on the File option on the menu bar, and select 'New Window'.

      You will see a (surprise!) new window, one without a title. This is an editing window. Into it we can type sequences of Python commands to form programs. Unlike the shell window, we won't see the effect of the commands as we type them; we'll have to execute them as a group after we enter them to see what they do.

      Into the new window, enter the following sequence of Python statements, just as you see them. Remember to press ENTER at the end of each line:

      Double-check that you typed the three lines exactly as you see them. Why is this a big deal? Because there is one intentional error in this program, and we're about to see how Python tells us about it. If you mistyped something, you may have created a second error, and if so the rest of this example won't go as we've planned.

      Before IDLE will let Python execute this program, it will insist that we save the program as a file. This is a good idea; by saving it, we won't have to type it in again. Let's let IDLE nag us. In the menu bar, choose 'Run', and from the drop-down menu choose 'Run Module.' Immediately, IDLE will pop up a little window that says, 'Source Must Be Saved. OK to Save?' Click OK, and IDLE will show you a Save As window. Give it the name name.py and click 'Save'. Immediately, Python will start running your program; you'll have to look at the Python Shell window to interact with it.

      In the shell window, you should see the 'Please enter your name:' message. Go ahead and type in your name, followed by the ENTER key. The program will greet you, but then will encounter a problem. Here's what you should see in the Python Shell window (if your name is Rumpelstiltskin!):

      When you see a 'Traceback' message block in red, you know that there's a problem with your program. In this case, as we mentioned above, we inserted an error intentionally. The problem is that we are trying to create a message by concatenating (gluing together, if you will) three pieces of information. That's allowed, but only if the pieces are all collections of characters. Here, len(name) produces a number, not a collection of characters, and so Python is not able to concatenate it with the surrounding characters.

      To fix this error, go back to the program window (which is now named 'name.py') and change len(name) to str(len(name)) without changing anything else. Choose 'Run' and 'Run Module' again, and Python will ask that you approve the saving of the source. Click 'OK', and enter your name in the shell window again. If you entered the program accurately and made the change correctly, here's the result of the program's execution:

      One last thing: Go back to the 'name.py' window and run the program one more time. Did you notice that IDLE didn't ask for the program to be saved? That's because you didn't change it since the last execution.

      You now know enough to enter, save, and run Python programs using IDLE!

  4. Exiting IDLE

    When you're done, to leave IDLE all you have to do is close the windows. Because IDLE is so insistent that you save your program before each execution, it's hard to lose your changes when you leave IDLE. But, if you want to be really safe, you can save your program manually before closing the editing window. Choose 'File' on the menu bar, and 'Save' from the drop-down menu.

  5. Where Can I Go to Learn More About IDLE?

    Of course, this web page only touched on IDLE's capabilities. If you would like to learn more, here are some sources of additional information:

    • IDLE's Own Help Information: IDLE's menu bar has a 'Help' option.
    • python.org: Python's web site, python.org, has extensive information about Python, including IDLE. In particular, see: http://docs.python.org/py3k/library/idle.html.
    • Appendix B of Zelle's Book: Our textbook has an appendix with information on using Python and IDLE.
    • That Goll-Darn World-Wide-Web Thang: There are lots of web sites with information about IDLE, including other introductory tutorials like this one. Pull up your favorite search engine and do some snooping.
Do you have a comment on this page? I'd like to hear it; you can email me atmccannl@acm.org.



broken image