Programming with Python

⌘K
  1. Home
  2. Docs
  3. Programming with Python
  4. Introduction to Python

Introduction to Python

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'

Loading

Views: 3

Articles

How can we help?

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments