0% found this document useful (0 votes)
14 views2 pages

Basics: Interactive Interpreter

Uploaded by

21a21a04a8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

Basics: Interactive Interpreter

Uploaded by

21a21a04a8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

PYTHON PROGRAMMING APPLICATIONS LAB

ExerciseI Basics
instructiongin
a) Running Interactive interpreter and a Python Seript
1.UsingInteractive Prompt:-
interactive mode would be started
It is the simplest way to run the python programs. This of the
console and with IDE(Integrated Development Environment). The drawback
with DOS
save a file.
interactive mode is it doesn't allow your program to
X
3.9.5
eIDLEShell
Window Helo
Cile Edit Shell Debug Options 64 bit (A ^
May 3 2021, 17:27:52) [MSC v.1928
erthon 3.9.5 (tags/v3.9.5:0a7dcbd,
win32
D64) ) Tn for more information.
Tsme nhelp", "copyright", "creditg" or "licenge () n
Lab)
nt ("Helld, Welcome to Python
Python Lab
tello, Weicome to

Environment:
2, Using the Integrated Development
Interface(GUI) environment as well .It
We can run python from Graphical User
Debug etc.
provides lot of menu's like File, Edit, Shell,

Click on the file and click on new file


* Type your python code
Save the file with .py" as extension
file that contains python instructions
The python program is simply a text results being
on the run tab to run the program .If everything goes well, you will see
Click
will see errors otherwise
displayed in the python shell prompt. You

Pr0yems/Pythc/Pthon3913.py(3.9.5;
Vsets'del:-gpDeld Lersi
Options Window Help
Edit Format Run
X=10
y=20

numbers 1s", sum)


SNt ("sumf

Ln: 4 Col: 34

SWARNANDHRA cOLLEGE OF ENGINEERING &TECHNOLOGY Page 1


PYTHON PROGRAMMING APPLICATIONS LAB
Output:
A IDLE Shell 3.9.5
File Edit
Shell Debug Options Window Help
PythOn 3.9.5 3 2021, 17:27:52)) (MSC v.1928 64 bir (.
D64) ] on win32(tags/v3.9.5:0a7dcbd, MaY
*3Pnelp", "copyright, "reditsn or license () " for more information.

Sum of twO
RESTART: C:/0sers/dell/AppData/Local/ Programs / Python/Python39/la.py
nwmbers is 30

Ln: 6 Col: 4
3. Invoking the Python Interpreter From Command
Prompt:
We can invoke from the DOS conmand
prompt
º To use this way of execution we have to set the path as
follows.
Click on start
Right click on ny computer and select properties.
Separate window will be open and click on advanced system settings in it.
System properties window will be open here click on environment variables button.
Go to the system variable window and select the path variable button
º Put(;) at the end for the variable value and type (C:\python 27) and
click OK and closed all
windows
Open the DOS command prompt and go to the directory where you have saved your files
Type "python file_name.py" and press enter
lf everything goes well, you will see results being displayed in the python shell
prompt (or)
you willsee errors otherwise
b) Write a program to purposefully raise Indentation Error and correct it
Source code :
Error Code Error Corrected Code
irTrue: if True:
prn("True") print("True")
clse: clse:
prin("False") print("False")

Output:
True
ir True: if True:
prin("True l") prn("Truel")
Pim"Truc2")
print("Truc")
else:
clse:
prin("False")
prin("False")
Output:
Truel
True2

You might also like