UrbanPro
true

Learn Python Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Getting started with Python IDLE

Ashish K Sharma
02/12/2021 0 0

Now that we have looked at some example programs, we would like to learn how to begin the actual process of writing a program in Python. There are a variety of ways to tell Python to execute the code we type. Let us take a look at a few ways.

                                                         The Interactive Prompt.
Perhaps the simplest way to run Python is to type them at Python's interactive command line,also called as interactive prompt. Assuming the interpreter is installed as an executable program on your system, the way to start an interactive interpreter session is usually just to type python at your operating system’s prompt,without any arguments. The familiar Python Interpreter opens up with the sign:

                                                         >>>

ready to accept commands!
   

Now,the interpreter is ready to execute any coomand you type. For example,typing
                                                >>> print("Hello,World") will produce the output
                                                 Hello,World!

When coding interactively like this, you can type as many Python commands as you like; each is run immediately after it’s entered.To exit an interactive session like this one and return to your system shell prompt,on MS-DOS and Windows systems, type Ctrl-Z to exit.


                                          The benefits of Interactive prompt
 
The interactive prompt runs code and echoes results as you go, but it doesn’t save your code in a file. Although this means you won’t do the bulk of your coding in interactive sessions, the interactive prompt turns out to be a great place to both experiment with the language and test program files on the fly.

Now, let us take a look at IDLE.(Integrated Development Learning Environment)


                                                      The IDLE User Interface

So far, we’ve seen how to run Python code with the interactive prompt.If you’re looking for something a bit more visual, IDLE provides a graphical user interface for doing Python development, and it’s a standard and free part of the Python system. It is usually referred to as an integrated development environment (IDE), because it binds together various development tasks into a single view.

In short, IDLE is a GUI that lets you edit, run, browse, and debug Python programs,all from a single interface. For many, IDLE represents an easy-to-use alternative to typing command lines, and a less problem-prone alternative to clicking on icons.

                                                          IDLE Basics

Let’s take an  example. IDLE is easy to start under Windows—it has an entry in the Start button menu for Python.The Python shell window that opens initially is the main window, which runs an interactive session (notice the >>> prompt). This works like all interactive sessions—code you type here is run immediately after you type it—and serves as a testing tool. To make (or edit) a source code file under IDLE, open a text edit window: in the main window, select the File pull-down menu, and pick New Window (or Open... to open a text edit window displaying an existing file for editing). It is in the text edit window that you write your actual program.

To run a file of code that you are editing in IDLE, select the file’s text edit window, open that window’s Run pull-down menu, and choose the Run Module option listed there (or use the equivalent keyboard shortcut, given in the menu). Python will let you know that you need to save your file first if you’ve changed it since it was opened or last saved and forgot to save your changes. When run this way, the output of your script and any error messages it may generate show up back in the main interactive window (the Python shell window).

IDLE is free, easy to use, portable, and automatically available on most platforms. 

Thus,now, I have completed the lesson and the students can now start  writing simple programs in Python. They may feel free in contacting me in case thay are experiencing any problems.

 

 

0 Dislike
Follow 1

Please Enter a comment

Submit

Other Lessons for You

Python Programming
Python is a widely used general-purpose, high-level programming language. This is an Open Source Software and its source code is available with a license in which the Copyright holder provides the rights...

Difference between Python 2.x and Python 3.x
Python 2.x and Python 3.x differs in following features: Division operator print function Unicode xrange Error Handling __future__ module

Black in Python
When you are upturn in your career from beginner to experienced in programming world, your team will start looking at ‘how you are writing?’ Here the responsibility piling up. Okay,...

OS Module
1. OS module interacts with your operating system. Use this to create folder, remove folder, move folder, change the working directory. Ex: import oscurDir=os.getcwd() #get current working directoryprint(curDir)os.mkdir('praveen')...

Python/Dejango Training
Python/Django Training Content Duration: 2.5 months 1. Introduction to Python Python - The Universal Language 2. Getting Started Installing Python Python - *Hello World* Using the Interpreter Python...
X

Looking for Python Training Classes?

The best tutors for Python Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Python Training with the Best Tutors

The best Tutors for Python Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more