Beruflich Dokumente
Kultur Dokumente
GOMTINAGAR, LUCKNOW
Training In-charge
Mr. Vaibhav Mishra
Er. No.-151409
1
DECLARATION
I hereby declare that the work reported in the Summer Training program project
Shubhankar Sharma
2
CERTIFICATE
3
ACKNOWLEDGEMENT
I am grateful to NIIT Gomti Nagar, Lucknow for giving me opportunity to carry
out the project work in the area of console based portal designing during my
training. I would like to also thank my university, Jaypee University of
Engineering & Technology, Guna for giving permission and necessary
administrative support to take up the training form NIIT, Lucknow.
Deepest thanks to our Trainer Mr. Vaibhav Mishra for his guidance,
monitoring, constant encouragement and correcting various assignments of ours
with attention and care. He has taken pain to go through the project and training
sessions and make necessary corrections as when needed and we are very
grateful for that.
Shubhankar Sharma
4
Table Of Contents
DECLARATION………………………………………………………………2
CERTIFICATE…………………………………………………………………3
ACKNOWLEDGMENTS……………………………………………………4
EXECUTIVE SUMMARY……………………………………………………..7
ORGANISATION………………………………………………………………8
HISTORY…………………………………………………………………......9
CHAPTER 1. Introduction……………………………………….10
1.1 Python…………………………………………………………………..10
1.2 Scripting Language…………………………………………………….10
1.3 Object Oriented Programming…………………………………………11
1.4 History of python……………………………………………………..11
1.5 Behind the Scene of Python…………………………………………….12
5
4.2 Conditional
Statement……………………………………………………………..…...24
4.2.1 Conditional Statement Definition……………………………………25
4.2.2 Conditional Statement Example……………………………………25
4.3 Function………………………………………………………………26
4.3.1 Syntex & Examples…………………………………………………26
6
EXECUTIVE SUMMARY
Python is an interpreted, object-oriented, high-level programming language with
dynamic semantics. Its high-level built in data structures, combined with
dynamic typing and dynamic binding, make it very attractive for Rapid
Application Development, as well as for use as a scripting or glue language to
connect existing components together. Python's simple, easy to learn syntax
emphasizes readability and therefore reduces the cost of program maintenance.
Python supports modules and packages, which encourages program modularity
and code reuse. The Python interpreter and the extensive standard library are
available in source or binary form without charge for all major platforms, and
can be freely distributed.
7
ORGANISATION
NIIT is one the IT training Institute in the India, through its partner offers high
quality Courses for 4 & 6 weeks. Few Courses in Summer Training Program are
Programming Techniques using 'C', PHP, VLSI, VHDL & PCB Design, Data
Structure using C Language, Python, Core Java, J2EE - Hibernate with Spring
Framework, J2EE - Struts with Hibernate Framework, Android, ASP.NET With
C#, Embedded & Robotics-Basics & Advanced, ARM, Linux Administration
with Scripting, Networking concepts with security.
8
HISTORY
NIIT was established in 1981 by Rajendra S. Pawar and Vijay K. Thadani,
graduates from IIT Delhi, with one million rupees. NIIT conceived a franchising
model in IT education for the very first time, setting up nine centers by 1987.
In 1986, NIIT began its foray into the software domain, beginning with Software
Product Distribution under the 'Insoft' brand. The company also began offering
advice and consultancy to large corporations on how to leverage technology and
make optimum use of their IT investments.
In 1988, NIIT introduced many marketing and advertising strategies for the
Indian market including the ‘Computerdrome’ in 1990. Another initiative
launched by NIIT, was its Bhavishya Jyoti Scholarships program, launched in
1991, which was targeted at deserving and socially challenged students with an
aim to improve their skills and employability quotient. In 1992, NIIT launched
its flagship program GNIIT, an industry-endorsed course with a 12-month
Professional Practice for students seeking careers in the IT and non-IT sectors.
By 1993, NIIT began trading NIIT stocks on the Indian stock exchanges. In
1996, NIIT began its globalization journey, setting up an education center in
Hong Kong
9
Chapter-: 1
Python
Python is a widely used high-level, general-purpose, interpreted, dynamic
programming language. Its design philosophy emphasizes code readability, and
its syntax allows programmers to express concepts in fewer lines of code than
would be possible in languages such as C++ or Java. The language provides
constructs intended to enable clear programs on both a small and large scale.
Python supports multiple programming paradigms, including object-oriented,
imperative and functional programming or procedural styles. It features a
dynamic type system and automatic memory management and has a large and
comprehensive standard library. Python interpreters are available for
installation on many operating systems, allowing Python code execution on a
wide variety of systems.
Scripting Language
A scripting or script language is a programming language that supports scripts,
programs written for a special run-time environment that automate the
execution of tasks that could alternatively be executed one-by-one by a human
operator.
Scripting languages are often interpreted (rather than compiled). Primitives
are usually the elementary tasks or API calls, and the language allows them to
be combined into more complex programs. Environments that can be
automated through scripting include software applications, web pages within a
web browser, the shells of operating systems (OS), embedded systems, as well
as numerous games.
A scripting language can be viewed as a domain-specific language for a
particular environment; in the case of scripting an application, this is also
known as an extension language. Scripting languages are also sometimes
referred to as very high-level programming languages, as they operate at a
high level of abstraction, or as control languages.
10
Object Oriented Programming Language
Object-oriented programming (OOP) is a programming paradigm based on the
concept of "objects", which may contain data, in the form of fields, often
known as attributes; and code, in the form of procedures, often known as
methods. A distinguishing feature of objects is that an object's procedures can
access and often modify the data fields of the object with which they are
associated (objects have a notion of "this" or "self").
In OO programming, computer programs are designed by making them out of
objects that interact with one another. There is significant diversity in
objectoriented programming, but most popular languages are class-based,
meaning that objects are instances of classes, which typically also determines
their type.
History
Python was conceived in the late 1980s, and its implementation was started in
December 1989 by Guido van Rossum at CWI in the Netherlands as a successor
to the ABC language (itself inspired by SETL) capable of exception handling
and interfacing with the Amoeba operating system. Van Rossum is Python's
principal author, and his continuing central role in deciding the direction of
Python is reflected in the title given to him by the Python community,
benevolent dictator for life (BDFL).
11
“Python is an experiment in how much freedom programmers need.
Too much freedom and nobody can read another's code; too little
and expressiveness is endangered.”
- Guido van Rossum
12
Chapter-: 2
Data Type
Data types determine whether an object can do something, or whether it just
would not make sense. Other programming languages often determine
whether an operation makes sense for an object by making sure the object
can never be stored somewhere where the operation will be performed on the
object (this type system is called static typing). Python does not do that.
Instead it stores the type of an object with the object, and checks when the
operation is performed whether that operation makes sense for that object
(this is called dynamic typing).
Python has many native data types. Here are the important ones:
Numbers can be integers (1 and 2), floats (1.1 and 1.2), fractions (1/2 and
2/3), or even complex numbers.
Variable
Variables are nothing but reserved memory locations to store values. This means
that when you create a variable you reserve some space in memory.
13
Based on the data type of a variable, the interpreter allocates memory and
decides what can be stored in the reserved memory. Therefore, by assigning
different data types to variables, you can store integers, decimals or characters in
these variables.
Ex:
counter = 100 # An integer assignment
miles = 1000.0 # A floating point
name = "John" # A string
String
In programming terms, we usually call text a string. When you think of a string
as a collection of letters, the term makes sense.
All the letters, numbers, and symbols in this book could be a string.
For that matter, your name could be a string, and so could your address.
Creating Strings
In Python, we create a string by putting quotes around text. For example, we
could take our
otherwise useless
• "hello"+"world" "helloworld" # concatenation
• "hello"*3 "hellohellohello" # repetition
• "hello"[0] "h" # indexing
• "hello"[-1] "o" # (from end)
• "hello"[1:4] "ell" # slicing
• len("hello") 5 # size
• "hello" < "jello" 1 # comparison
• "e" in "hello" 1 # search
14
Python Operator
Arithmetic Operator
Comparison Operator
15
Logical Operator
16
Chapter-: 3
Tuples
A tuple is a sequence of immutable Python objects. Tuples are sequences, just
like lists. The differences between tuples and lists are, the tuples cannot be
changed unlike lists and tuples use parentheses, whereas lists use square
brackets.
Creating a tuple is as simple as putting different comma-separated values.
Optionally you can put these comma-separated values between parentheses
also.
For example −
tup1 = ('physics', 'chemistry', 1997, 2000);
tup2 = (1, 2, 3, 4, 5 );
tup3 = "a", "b", "c", "d";
To access values in tuple, use the square brackets for slicing along with the
index or indices to obtain value available at that index. For example −
tup1 = ('physics', 'chemistry', 1997, 2000);
tup2 = (1, 2, 3, 4, 5, 6, 7 );
print "tup1[0]: ", tup1[0]
print "tup2[1:5]: ", tup2[1:5]
When the above code is executed, it produces the following result −
tup1[0]: physics
tup2[1:5]: [2, 3, 4, 5]
Tuples respond to the + and * operators much like strings; they mean
concatenation and repetition here too, except that the result is a new tuple,
not a string. In fact, tuples respond to all of the general sequence operations
we used on strings in the prior chapter –
17
Built-in Tuple Functions
Python includes the following tuple functions −
18
List
The list is a most versatile datatype available in Python which can be written
as a list of comma-separated values (items) between square brackets.
Important thing about a list is that items in a list need not be of the same type.
Creating a list is as simple as putting different comma-separated values
between square brackets. For example −
list1 = ['physics', 'chemistry', 1997, 2000];
list2 = [1, 2, 3, 4, 5 ];
list3 = ["a", "b", "c", "d"];
Similar to string indices, list indices start at 0, and lists can be sliced,
concatenated and so on.
Output:list1[0]: physics
list2[1:5]: [2, 3, 4, 5]
19
Output:After deleting value at index 2 :
['physics', 'chemistry', 2000]
20
Python includes following list methods
21
Chapter-: 4
Loops
Programming languages provide various control structures that allow for more
complicated execution paths.
looping requirements.
22
Example:
For Loop:
>>> for mynum in [1, 2, 3, 4, 5]:
print "Hello", mynum
Hello 1
Hello 2
Hello 3
Hello 4
Hello 5
While Loop:
>>> count = 0
>>> while (count < 4):
print 'The count is:', count
count = count + 1
The count is: 0
The count is: 1
The count is: 2
The count is: 3
Conditional Statements:
23
Python programming language provides following types of decision making
statements. Click the following links to check their detail.
Example:
If Statement:
>>> state = “Texas”
>>> if state == “Texas”:
print “TX
TX
If...Else Statement:
>>> if state == “Texas”
print “TX”
else:
print “[inferior state]”
If...Else...If Statement:
>>> if name == “Paige”
print “Hi Paige!”
elif name == “Walker”:
print “Hi Walker!”
else:
print “Imposter!”
24
Function
Function blocks begin with the keyword def followed by the function name
and parentheses ( ( ) ).
Any input parameters or arguments should be placed within these
parentheses. You can also define parameters inside these parentheses.
The first statement of a function can be an optional statement - the
documentation string of the function.
The code block within every function starts with a colon (:) and is indented.
The statement return [expression] exits a function, optionally passing back an
expression to the caller. A return statement with no arguments is the same as
return None.
Syntex:
def functionname( parameters ):
"function_docstring"
function_suite
return [expression]
Example:
1. def printme( str ):
"This prints a passed string into this function"
print str
return
2. # Function definition is here
def printme( str ):
"This prints a passed string into this function"
print str
return;
# Now you can call printme function
printme("I'm first call to user defined function!")
printme("Again second call to the same function")
25
Dictionaries
Another useful data type built into Python is the dictionary (see Mapping Types
— dict). Dictionaries are sometimes found in other languages as “associative
memories” or “associative arrays”. Unlike sequences, which are indexed by a
range of numbers, dictionaries are indexed by keys, which can be any immutable
type; strings and numbers can always be keys. Tuples can be used as keys if they
contain only strings, numbers, or tuples; if a tuple contains any mutable object
either directly or indirectly, it cannot be used as a key. You can’t use lists as
keys, since lists can be modified in place using index assignments, slice
assignments, or methods like append() and extend().
It is best to think of a dictionary as an unordered set of key: value pairs, with the
requirement that the keys are unique (within one dictionary). A pair of braces
creates an empty dictionary: {}. Placing a comma-separated list of key: value
pairs within the braces adds initial key: value pairs to the dictionary; this is also
the way dictionaries are written on output.
The main operations on a dictionary are storing a value with some key and
extracting the value given the key. It is also possible to delete a key: value pair
with del. If you store using a key that is already in use, the old value associated
with that key is forgotten. It is an error to extract a value using a non-existent
key.
The keys() method of a dictionary object returns a list of all the keys used in the
dictionary, in arbitrary order (if you want it sorted, just apply
the sorted()function to it). To check whether a single key is in the dictionary,
use the in keyword.
26
Chapter-: 5
Scope of Python
Science
- Bioinformatics
System Administration
-Unix
-Web logic
-Web sphere
Web Application Development
-CGI
Testing scripts
Companies.
Google makes extensive use of Python in its web search system,
employs Python’s creator.
Intel, Cisco, Hewlett-Packard, Seagate, Qualcomm, and IBM use
Python.
27
For hardware testing.
ESRI uses Python as an end-user customization tool for its popular GI
mapping products.
- Dynamic typing
- Built-in types and tools
- Library utilities
- Third party utilities (e.g. Numeric, NumPy, SciPy)
- Automatic memory management
It's portable
28
CHAPTER-6
PROJECTS UNDERTAKEN
Build Game using Python programming languages
TITLE- “Space Invenstion”
TOOL
Python 2.6.1
CODE & IMPLEMENTION
29
30
31
CONCLUSIONS
Practical knowledge means the visualization of the knowledge, which we
read in our books. For this, we perform experiments and get observations.
Practical knowledge is very important in every field. One must be familiar with
the problems related to that field so that he may solve them and become a
successful person.
After achieving the proper goal in life, an engineer has to enter in
professional life. According to this life, he has to serve an industry, may be
public or private sector or self-own. For the efficient work in the field, he
must be well aware of the practical knowledge as well as theoretical
knowledge.
Due to all above reasons and to bridge the gap between theory and practical, our
Engineering curriculum provides a practical training of 45 days. During this
period
a student work in the industry and get well all type of experience and knowledge
about the working of companies and hardware and software tools.
32
REFERENCES
PERSONAL DETAILS
Shubhankar Sharma
E-Mail :- shubhankarsharma999@gmail.com
Contact No :- 9452915461
Address :- S-17/208 6 Ashok Vihar Colony Phase-I ,
Varanasi,Uttar Pradesh,India
33