Python Class 11 1
Python Class 11 1
INTRODUTION TO PYTHON
1.1 Introduction:
Ø
General-purpose Object Oriented Programming language.
Ø
High-level language
Ø
Developed in late 1980 by Guido van Rossum at National Research Institute for
Mathematics and Computer Science in the Netherlands.
Ø
It is derived from programming languages such as ABC, Modula 3, small talk, Algol-68.
Ø
It is Open Source Scripting language.
Ø
It is Case-sensitive language (Difference between uppercase and lowercase letters).
Ø
One of the official languages at Google.
Example:
>>>6+3
Output: 9
Note: >>> is a command the python interpreter uses to indicate that it is ready. The
interactive mode is better when a programmer deals with small pieces of code.
To run a python file on command line:
exec(open(“C:\Python33\python programs\program1.py”).read( ))
ii. Script Mode: In this mode source code is stored in a file with the .py extension and
use the interpreter to execute the contents of the file. To execute the script by the
interpreter, you have to tell the interpreter the name of the file.
Example:
if you have a file name Demo.py , to run the script you have to follow the following
steps:
Page 4
CHAPTER-2
PYTHON FUNDAMENTALS
2.2 TOKENS
Token: Smallest individual unit in a program is known as token.
There are five types of token in python:
1. Keyword
2. Identifier
3. Literal
4. Operators
5. Punctuators
as elif if or yield
All the keywords are in lowercase except 03 keywords (True, False, None).
Page 5