0% found this document useful (0 votes)
11 views9 pages

Report

Extracted project information

Uploaded by

bhattanushka60
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views9 pages

Report

Extracted project information

Uploaded by

bhattanushka60
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

CONTENTS

Topics Page no.

1. TITLE PAGE i
2. CERTIFICATE ii
3. ACKNOWLEDGEMENT iii
4. ABSTRACT iv
5. INFORMATION v

1.Introduction to Python 1 TO 2

1.1 What is Python


1.2 History
1.3 Python Features

2. Downloading and installing python

3. Datatypes and operators

4. Tuple and list

5. Loop and conditional statements

6. Programming

7. Self Assessment

8. Future scope

9. Conculsion
1 | P a g e.

INTRODUCTION

1.1 PYTHON

Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is


designed to be highly readable. It uses English keywords frequently where as other languages use
punctuation, and it has fewer syntactical constructions than other languages.

 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.

Python has a big list of good features:

 It supports functional and structured programming methods as well as OOP.


 It can be used as a scripting language or can be compiled to byte-code for building large
applications.
 It provides very high-level dynamic data types and supports dynamic type checking.
 IT supports automatic garbage collection.
 It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.
3|Page

OPERATORS

2.1 ARITHMETIC OPERATORS

Operator Description Example

+ Addition Adds values on either side of the operator. a + b = 30

- Subtraction Subtracts right hand operand from left hand a – b = -10


operand.

* Multiplication Multiplies values on either side of the operator a * b = 200

/ Division Divides left hand operand by right hand operand b/a=2

% Modulus Divides left hand operand by right hand operand b%a=0


and returns remainder
4|Page

** Exponent Performs exponential (power) calculation on a**b =10 to the power 20


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):

2.2 ASSIGNMENT OPERATOR

Operator Description Example

= 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

**= Exponent Performs exponential (power) calculation on c **= a is equivalent to c


AND operators and assign value to the left operand = c ** a
5|Page

//= Floor Division It performs floor division on operators and assign c //= a is equivalent to c =
value to the left operand c // a

2.3 IDENTITY OPERATOR

Operator Description Example

is Evaluates to true if the variables on either side of the operator point x is y,


to the same object and false otherwise. here is results in 1
if id(x) equals
id(y).

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

2.4 COMPARISON OPERATOR

Operator Description Example

& Binary AND Operator copies a bit to the result if it exists in (a & b) (means 0000
both operands 1100)

| Binary OR It copies a bit if it exists in either operand. (a | b) = 61 (means 0011


1101)

^ 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)

2.5 LOGICAL OPERATOR

Operator Description Example

and Logical AND If both the operands are true then condition (a and b) is true.
becomes true.

or Logical OR If any of the two operands are non-zero then (a or b) is true.


condition becomes true.

not Logical NOT Used to reverse the logical state of its operand. Not (a and b) is false.

2.6 MEMBERSHIP OPERATORS

Operator Description Example

in Evaluates to true if it finds a variable in the x in y, here in results in a


specified sequence and false otherwise. 1 if x is a member of
sequence y.

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.

Python Operators Precedence

Operator Description

** Exponentiation (raise to the power)

~+- Complement, unary plus and minus (method names for the last two are +@
and -@)

* / % // Multiply, divide, modulo and floor division


7|Page

+- Addition and subtraction

>> << Right and left bitwise shift

& Bitwise 'AND'

^| Bitwise exclusive `OR' and regular `OR'

<= < > >= Comparison operators

<> == != Equality operators

= %= /= //= -= += *= Assignment operators


**=

is is not Identity operators

in not in Membership operators

not or and Logical operators

You might also like