Harpreet Infosys Modi
Harpreet Infosys Modi
THE DEGREE OF
BACHELOR OF TECHNOLOGY
(INFORMATION TECNOLOGY)
JULY, 2023
SUBMITTED BY:
HARPREET SINGH
I “HARPREET SINGH” declare that I have undertaken one month training “Python Foundation
Certification Course” during a period from 03 July 2023 to 31 July 2023 in partial fulfillment
presented
training work.
Signature of student:
Today this modern era is world of technology and we cannot achieve anything in this field until
approach. Doing one month training at Infosys Springboard online platform helps me in better
understanding and implementation of theoretical knowledge that I gained. During This period I
have studied various concepts about python programming language. We studied about the
desktop applications both theoretical as well as practical and also learned the programming and
We are highly grateful to Dr. Sehajpal Singh, Director, GNDEC, Ludhiana, for providing us this
opportunity to carry out one month training at Infosys Springboard online platform. We express
We would like to express our deep sense of gratitude and thank profusely to course instructor at
Infosys who instructed us and assisted us during the training period. We also thanks to the
programming department for provision of excellent all the latest equipment’s and resources for
us to utilize. Training here was itself true learning experience which is going to help us
Certificate by Company/Industry/Institute i
Candidate’s Declaration ii
Abstract iii
Acknowledgement vi
About the institute v
List of Figures vi
CHAPTER 1 INTRODUCTION 1-16
1.1 Overview of Python Programming 1
1.2 Features of Python 1
1.3 Variables and Data types 3
1.4 Strings 5
1.5 List & Tuples 6
1.6 Dictionary 7
1.7 Conditional Expression 8
1.8 Loops 11
1.9 Function & Recursion 14
17
CHAPTER 2 (Result & Discussion)
3.1 Result
3.2 Discussion
REFERENCE
20-21
25
CHAPTER 1 - INTRODUCTION
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 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.
Features of a language are nothing but the set of services or facilities provided by the languagevendors to
Easy-to-learn: Python has few keywords, simple structure, and a clearly defined syntax. This allows the
Portable: Python can run on a wide variety of hardware platforms and has the same interface on all
platforms.
Object-oriented: Everything is considered to be an Object which possess some state, behavior andall the
1
Secured: All the code is converted in bytecode after compilation, which is not readable by a
human and java does not use an explicit pointer. It enables to develop virus-free, tamper-free
system/applications. Dynamic: Python provides a better structure and support for large
Easy-to-read: Python code is more clearly defined and visible to the eyes.
A broad standard library: Python's bulk of the library is very portable and cross platform compatible on
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
Scalable: Python provides a better structure and support for large programs than shell scripting.
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.
2
fig. 1.1 Features of Python
VARIABLES
A Python variable is a reserved memory location to store values. In other words, a variable in a python
3
Examples of few valid variable names,
DATA TYPES:
Data types are the classification or categorization of data items. It represents the kind of value that tells
what operations can be performed on a particular data. Since everything is an object in Python
programming, data types are actually classes and variables are instance (object) of these classes.
• Integers
• Strings
• Booleans
• None
Operators in Python
Operators are the constructs which can manipulate the value of operands.
Consider the expression 4 + 5 = 9. Here, 4 and 5 are called operands and + is called operator.
4
The string is a data type in Python. A string is a sequence of characters enclosed in quotes. In
Python, Strings are arrays of bytes representing Unicode characters. However, Python does not have
a character data type, a single character is simply a string with a length of 1. Square brackets can be
String Functions
Some of the most used functions to perform operations on or manipulate strings are:
• endswith(“rry”) : This function tells whether the variable string ends with the string “rry” or not. If
string is “harry”, it returns for “rry” since harry ends with rry.
• find(word) : This function finds a word and returns the index of first occurrence of that word in
the string.
5
List
Lists are containers to store a set of values of any data type. List in Python are ordered and have a definite
count. The elements in a list are indexed according to a definite sequence and the indexing of a list is done
with 0 being the first index. Each element in the list has its definite place in the list, which allows
duplicating of elements in the list, with each element having its own distinct place and credibility. Lists in
Python can be created by just placing the sequence inside the square brackets[].
The list can contain different types of elements such as int, float, string, Boolean, etc. Above list is a
List Methods
5. pop(2) – It will delete the element at index 2 and return its value
A tuple is an immutable (can’t change or modified) data type in Python. A Tuple is a collection of Python
objects separated by commas. In some ways a tuple is similar to a list in terms of indexing, nested objects
and repetition but a tuple is immutable unlike lists which are mutable.
6
Tuple methods:
Example: - a = (1, 7, 2)
1.6 Dictionary
Dictionary
Dictionary is a collection of key-value pairs. Key-value is provided In the dictionary to make it more
optimized.
• It is unordered
• It is mutable
• It is indexed
“from”: “India”,
“marks”: [92,98,96]}
7
1. items() : returns a list of (key,value) tuple.
4. get(“name”) : returns the value of the specified keys (and value is returned e.g., “Harry” is
returned here)
All these are decisions that depend on the condition being met.
In python programming too, we must be able to execute instructions on a condition(s) being met. This is
If else and elif statements are a multiway decision taken by our program due to certain conditions in our
code.
Syntax:
'''
print(“yes”)
8
print(“No”)
else: // otherwise
print(“May be”)
'''
Code example:
a = 22
if (a>9):
print(“Greater”) else:
print(“lesser”)
elif clause elif in python means [else if]. If statement can be chained together with a lot of these
Syntax:
'''
if (condition1):
#code
#code
#code
….
else:
9
#code '''
Important Notes:
• Last else is executed only if all the conditions inside elifs fail.
1.8 Loops
Sometimes we want to repeat a set of statements in our program. For instance: Print 1 to 1000 Loops
make it easy for a programmer to tell the computer, which set of instructions to repeat, and how!
• While loop
• For loop
While Loop
• In while loops, the condition is checked first. If it evaluates to true, the body of the loop is
• If the loop is entered, the process of condition check and execution is continued until the condition
becomes false.
10
For Loop
A for loop is used to iterate through a sequence like a list, tuple, or string (iterables).
l = [1, 7, 8]
for item in l:
print(item)
An optional else can be used with a for loop if the code is to be executed when the loop exhausts.
Example:
l = [1, 7, 8]
for item in l:
print(item)
else:
11
Output:
Done
‘break’ is used to come out of the loop when encountered. It instructs the program to – Exit the loop
now.
Example:
3 if i == 3: break
‘continue’ is used to stop the current iteration of the loop and continue with the next one. It instructs the
Example:
for i in range(4):
print(“printing”)
continue
12
print(i)
pass statement
Example:
l = [1, 7, 8]
for item in l:
pass #without pass, the program will throw an error
A function is a group of statements performing a specific task. When a program gets bigger in size and its
complexity grows, it gets difficult for a programmer to keep track of which piece of code is doing what!
A function can be reused by the programmer in a given program any number of times.
Example and Syntax of a function: -
def func1():
print(“Hello”)
This function can be called any number of times, anywhere in the program.
Function call
Whenever we want to call a function, we put the name of the function followed by parenthesis as
follows:
Function definition
The part containing the exact set of instructions that are executed during the function call.
13
Types of functions in Python
A function can accept some values it can work with. We can put these values in the parenthesis. A
Recursion
Recursion is a function which calls itself. It is used to directly use a mathematical formula as a
function.
14
CHAPTER - 2 (RESULT AND DISCUSSION)
3.1 Result
language. It was created by Guido van Rossum during 1985- 1990. Like Perl, Python source code is also
As a general-purpose programming language, Python is designed to be used in many ways. You can build
web sites or industrial robots or a game for your friends to play, and much more, all using the same core
technology.
Python’s flexibility is why the first step in every Python project must be to think about the project’s
audience and the corresponding environment where the project will run. It might seem strange to think
about packaging before writing code, but this process does wonders for avoiding future headaches.
3.2 Discussion
• pip vs easy_install
Chapter-3 (CONCLUSION AND FUTURE SCOPE)
15
4.1 Conclusion
I believe the trail has shown conclusively that it is both possible and desirable to use python as the
- It is trivial to install on a Window PC allowing students to take their interest further. For many the
hurdle of installing a Pascal or C compiler on a windows machine is either too expensive or too
complicated;
- It is a flexible tool that allows both the teaching of traditional procedural programming and modern
- It is a real- world programming language that can be and is used in academia and the commercial
world;
- It appears to be quicker to learn and, in combination with its many libraries, this offers the possiblity
of more rapid student development allowing the course to be made more challenging and varied;
- and most importantly, its clean syntax offers increased understanding enjoyment for students;
4.2 Future Scope
This project will help the store keeper, administration etc.in fast billing. Python is a high level and multi-
paradigm programming language designed by Guido van Rossum, a Dutch programmer, having all the
16
It is one of the fastest growing languages and has undergone a successful span of more than 25 years as
far as its adoption is concerned. This success also reveals a promising future scope of python
programming language.
In fact, it has been continuously serving as the best programming language for application development,
web development, game development, system administration, scientific and numeric computing, GIS and
Mapping etc.
References: -
1. https://infyspringboard.onwingspan.com/web/en/page/home
17
18