Report
Report
1. TITLE PAGE i
2. CERTIFICATE ii
3. ACKNOWLEDGEMENT iii
4. ABSTRACT iv
5. INFORMATION v
1.Introduction to Python 1 TO 2
6. Programming
7. Self Assessment
8. Future scope
9. Conculsion
1 | P a g e.
INTRODUCTION
1.1 PYTHON
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.
1.2HISTORY OF PYTHON
Python was developed by Guido van Rossum in the late eighties and early nineties at the National
Research Institute for Mathematics and Computer Science in the Netherlands.
Python is derived from many other languages, including ABC, Modula-3, C, C++, Algol-68,
SmallTalk, and Unix shell and other scripting languages.
Python is copyrighted. Like Perl, Python source code is now available under the GNU General Public
License (GPL).
Python is now maintained by a core development team at the institute, although Guido van Rossum still
holds a vital role in directing its progress.
1.3PYTHON FEATURES
Python's features include:
Easy-to-learn: Python has few keywords, simple structure, and a clearly defined syntax. This
allows the student to pick up the language quickly.
2|Page
Easy-to-read: Python code is more clearly defined and visible to the eyes.
Easy-to-maintain: Python's source code is fairly easy-to-maintain.
A broad standard library: Python's bulk of the library is very portable and cross-platform
compatible on UNIX, Windows, and Macintosh.
Interactive Mode: Python has support for an interactive mode which allows interactive testing
and debugging of snippets of code.
Portable: Python can run on a wide variety of hardware platforms and has the same interface on
all platforms.
Extendable: You can add low-level modules to the Python interpreter. These modules enable
programmers to add to or customize their tools to be more efficient.
Databases: Python provides interfaces to all major commercial databases.
GUI Programming: Python supports GUI applications that can be created and ported to many
system calls, libraries and windows systems, such as Windows MFC, Macintosh, and the X
Window system of Unix.
Scalable: Python provides a better structure and support for large programs than shell scripting.
OPERATORS
// Floor Division - The division of operands where 9//2 = 4 and 9.0//2.0 = 4.0,
the result is the quotient in which the digits after -11//3 = -4, -11.0//3 = -4.0
the decimal point are removed. But if one of the
operands is negative, the result is floored, i.e.,
rounded away from zero (towards negative
infinity):
= Assigns values from right side operands to left side c = a + b assigns value of a
operand + b into c
+= Add AND It adds right operand to the left operand and assign c += a is equivalent to c =
the result to left operand c+a
-= Subtract AND It subtracts right operand from the left operand and c -= a is equivalent to c = c
assign the result to left operand -a
*= Multiply AND It multiplies right operand with the left operand c *= a is equivalent to c =
and assign the result to left operand c*a
/= Divide AND It divides left operand with the right operand and c /= a is equivalent to c = c
assign the result to left operand / ac /= a is equivalent to c
=c/a
%= Modulus It takes modulus using two operands and assign the c %= a is equivalent to c =
AND result to left operand c%a
//= Floor Division It performs floor division on operators and assign c //= a is equivalent to c =
value to the left operand c // a
is not Evaluates to false if the variables on either side of the operator point x is not y, here is
to the same object and true otherwise. not results in 1 if
id(x) is not equal
to id(y
& Binary AND Operator copies a bit to the result if it exists in (a & b) (means 0000
both operands 1100)
^ Binary XOR It copies the bit if it is set in one operand but (a ^ b) = 49 (means 0011
not both. 0001)
~ Binary Ones It is unary and has the effect of 'flipping' bits. (~a ) = -61 (means 1100
Complement 0011 in 2's complement
form due to a signed
binary number.
<< Binary Left Shift The left operands value is moved left by the a << 2 = 240 (means 1111
number of bits specified by the right operand. 0000)
6|Page
>> Binary Right Shift The left operands value is moved right by the a >> 2 = 15 (means 0000
number of bits specified by the right operand. 1111)
and Logical AND If both the operands are true then condition (a and b) is true.
becomes true.
not Logical NOT Used to reverse the logical state of its operand. Not (a and b) is false.
not in Evaluates to true if it does not finds a variable in x not in y, here not in
the specified sequence and false otherwise. results in a 1 if x is not a
member of sequence y.
Operator Description
~+- Complement, unary plus and minus (method names for the last two are +@
and -@)