Table of Contents
show
Python is interpreted:
Python is processed at runtime by the interpreter. No need to compile the program before executing it
Python is interactive:
Interaction can be made at the python prompt directly to write the programs
Python Interpreter mode (Script Mode)
- This mode is used to execute python program written in a file.
- Such a file is called a script
- Scripts can be saved to disk for future use.
- Python scripts have the extension .py
- To execute the file in script mode type filename.py in command prompt
firstprogram.py
print("Welcome all for python class")
C:\Users\Sathish\Desktop\Python Tutorial\python_notes\Unit 2>firstprogram.py Welcome all for python class
Python Interactive mode
- Type python in the command prompt
- It will give the python interpreter prompt i.e., “>>>” which is also known as python chevron prompt
- The >>> symbol indicates that python interpreter is waiting for an expression or command.
- The interactive environment where we are interacting with the python interpreter is called the console or command shell
>>> 8
8
>>> 8+1
9
>>> 8-1
7
>>> 8*2
16
>>> 8/2
4.0
>>> print("Hello")
Hello
>>> "Hello"
'Hello'
Views: 3