Python is a highlevel interpreted interactive and objectoriented
• Python is a high-level, interpreted, interactive and object-oriented scripting language. • Python is designed to be highly readable. • Python is Interpreted − Python is processed at runtime by the interpreter. You do not need to compile your program before executing it. This is similar to PERL and PHP. • Python is Interactive − You can actually sit at a Python prompt and interact with the interpreter directly to write your programs. • Python is Object-Oriented − Python supports Object-Oriented style or technique of programming that encapsulates code within objects. • Python is a Beginner's Language − Python is a great language for the beginner-level programmers and supports the development of a wide range of applications from simple text processing to WWW browsers to games
First Python Program • Interactive Mode Programming >>> print "Hello, Python!“ Script Mode Programming Let us write a simple Python program in a script. Python files have extension. py. Type the following source code in a test. py file − print "Hello, Python!“ $ python test. py
Type the following at prompt print “hello” print 8*3 print 3**3 print k=3+4*3 print k
Step 1 (Create program file) Below steps are for simple hello world program a. Click Start button->All Programs -> Python<version>->IDLE b. Now click File->New in IDLE Python Shell Now type print “hello” print “world” print “python is”, ”object oriented programming lang. ” c. Click File->Save and then save the file with filename and. py extension
Step 2 (Run program file) a. Click Open command from IDLE’s File menu and select the file you have already saved b. Click Run-> Run Module c. It will execute all the commands of program file and display output in separate python shell window
- Slides: 5