You are on page 1of 9

Chapter 2 – Getting Started with Python-Module-II

Module II:Python –Spyder IDE; Interactive Mode; Script Mode

Working in Spyder IDE:

Spyder is a powerful interactive development environment for the Python language with advanced
editing , interactive testing ,debugging and introspection features. Spyder IDE is the most preferred choice.
It comes preloaded with Anaconda distribution.

To launch Spyder IDE:


1. Launch Anaconda Navigator
2. Click on Spyder Tile in Anaconda navigator ot alternatively you can
directly click at
Start button Programs Anaconda(folder name) Spyder

Spyder Interface:
Once the spyder is loaded,you will see following interface:

Page 1 of 9
Page 2 of 9
The python console takes commands in front of In[ ] and often shows output with Out[ ] lines.

Interactive mode:

To work in interactive mode in Spyder IDE ,type your command(s) in IPython console pane of spyder

window. It will give you the output of the command there itself. See fig. above where we type command;

print(“Hello”)

Page 3 of 9
Script Mode:

To work in script mode in Spyder IDE, type your script’s commands in the editor pane.

 To start a new script file,click File New file…..


 To save current script,use command File Save or File Save As
 Python scripts have file extension as.Py

Page 4 of 9
Please make sure to select file type as Python Files.

Page 5 of 9
After typing the script(save it),you can run your script by:

Clicking on Run Run Command

Or by pressing shortcut key F5

Page 6 of 9
PyScripter IDE-another Popular IDE:

There is another free and open source IDE can be used for writing and executing Python programs.Its
interface looks like as shown below. For interactive mode ,type directly commands in console window and
for script mode ,can write script in editor pane and then run it by pressing Run icon or through Run menu.

Page 7 of 9
Now you are familiar with different ways of working with Python, we can begin with our simple statement
ofprogram.

Understanding print( )

To print or display output, Python 3.x provides print function( ).

print( <objects to be printed>)

For Example:

print(“Hello Class XI”)

it will print:

Hello Class XI

Now type:

print(‘Delhi Public School’)

it will print

Delhi Public School

Explanation:

Carefully notice that first string is enclosed in double quotes and second in single quotes. Both the strings
are valid,but just ensure that opening and closing quotation mark should be of same type.

Page 8 of 9
Assignment question:

1.What do you mean by cross platform?

2. Python is free and open source. What do you mean by this statement?

3. What is the difference between interactive and script mode in Python?

4. Which of the following are not valid strings in Python:

(a) “hello” (b) ‘hello’ (c ) “hello’ (d) ‘hello” (e) (hello)

5. What will be the output of following code:

# This is sample program

print(“take every chance”)

#print(“such as”)

print(“Drop every fear”)

Page 9 of 9

You might also like