2nd Merged
2nd Merged
(Session : 2024-25)
Submitted by: Submitted to:
Mr. Danish Sharma Dr. Maninder Singh Nehra
CSE-1(7th Semester) Assistant Professor
21EEBCS027 CSE Department
Danish sharma
I would like to express my sincere gratitude to technophilia for providing me with an enriching
and comprehensive learning experience during the two-month internship program.This journey
has been incredibly rewarding, and I am immensely thankful for the knowledge, skills, and
insights gained throughout the program. The well- structured curriculum, hands-on projects, and
guidance from the experienced instructors have been instrumental in shaping my understanding
of python programming.. The well- structured curriculum, hands-on projects, and guidance from
the experienced instructors have been instrumental in shaping my understanding of python
programming.I would like to extend my appreciation to the entire technophilia team for their
dedication and support. The collaborative learning environment, regular feedback sessions, and
real-world application of concepts have significantly enhanced my proficiency in python
programming . Once again, thank you, technophilia , for providing me with this invaluable
opportunity.
Regards,
Danish Sharma
Abstract
Python is a versatile, high-level programming language known for its readability, simplicity, and
extensive libraries, making it ideal for beginners and professionals alike. Initially developed in
the late 1980s, Python has grown significantly, becoming one of the most popular programming
languages for web development, data science, artificial intelligence, machine learning, and
automation. Its clean syntax and dynamic semantics encourage productivity and ease of
debugging, leading to reduced development time.Python supports multiple programming
paradigms, including procedural, object-oriented, and functional programming, giving
developers flexibility in coding styles. Its large community and ecosystem provide robust
libraries and frameworks, such as Django, Flask, Pandas, and TensorFlow, which facilitate
development across a wide array of applications. The language’s extensive use in data-driven
fields is further enhanced by its compatibility with other programming languages, scalability,
and continuous improvement through regular updates.Python’s simplicity, combined with its
powerful tools and libraries, enables rapid application development and seamless integration,
proving indispensable across various industries, including finance, healthcare, technology, and
education.
2 Scripting language
3 Oops introduction
8 Functions
10 Projects
11 Conclusion
12 References
Chapter 1
Python is a high-level, interpreted programming language designed for simplicity and ease of
use. Its development was conceived by Guido van Rossum in the late 1980s and released for the
first time in 1991. Over the years, Python has grown into one of the most popular and versatile
programming languages in the world. It is used in diverse fields ranging from web development
and data science to machine learning and artificial intelligence. In this article, we will explore the
evolution of Python, its various versions, and its role in modern software development.
Guido van Rossum designed Python as a successor to the ABC programming language, which
was developed at the Centrum Wiskunde & Informatica in the Netherlands. ABC was a teaching
language, and while it was designed to be simple, it had many limitations. Van Rossum’s goal
with Python was to create a language that was intuitive, highly readable, and extensible. Python's
first version, Python 0.9.0, was released in February 1991. It included many of the features that
are still prominent in Python today, such as exception handling, functions, and the core data
types like strings, lists, and dictionaries.
Python is widely appreciated for its simplicity and readability, which makes it an excellent
choice for both beginners and experienced programmers. The key features of Python include:
• Readability: Python emphasizes code readability and clean syntax. It uses indentation to
define code blocks, which makes the structure of Python code easily understandable.
• Dynamic Typing: Python is dynamically typed, meaning variable types do not need to be
declared explicitly. This flexibility allows for faster prototyping and reduces boilerplate
code.
• Extensive Standard Library: Python comes with a vast standard library that provides
tools for file I/O, regular expressions, threading, databases, and more. This reduces the
need for external libraries in many applications.
• Object-Oriented and Functional: Python supports multiple programming paradigms,
including object-oriented programming (OOP) and functional programming, enabling
developers to use the best features of each approach.
• Cross-Platform Compatibility: Python code can run on various platforms, such as
Windows, macOS, Linux, and more. This makes it an excellent choice for cross-platform
software development.
• Interpreted Language: Python code is executed by an interpreter, which allows for
interactive development. This means that developers can test and modify code quickly.
Python’s development can be broken down into several key milestones. Each new version
introduced new features, optimizations, and sometimes breaking changes. Let’s look at some of
the major Python versions and their impact.
Python 1.x
• First Release: Python 1.0 was released in January 1994, following the initial release of
version 0.9.0 in 1991. It had the core features of the language we know today, including
basic data types, functions, exception handling, and more.
• Python 1.5 (1997): Python 1.5 introduced several important features, including the long
integer type and the string module. It also laid the foundation for the integration of
modules and libraries that would make Python more versatile.
Python 2.x
• Python 2.0 (2000): This version marked a significant shift in Python’s development. The
language became more robust and had a more mature feature set. Python 2.x introduced
list comprehensions, garbage collection, and the ability to handle Unicode, among other
improvements.
• Python 2.7 (2010): The last release in the 2.x series, Python 2.7, was considered a long-
term support (LTS) release and continued to be widely used even after the introduction of
Python 3. Python 2.7 included improvements such as better integration with newer
libraries, optimizations, and minor syntax changes. Python 2.x versions, however, were
not compatible with Python 3, making the transition between the two series a significant
challenge for developers.
Chapter 2
Python is considered a scripting language due to its ability to automate tasks, its interpreted
nature, and its focus on ease of use and quick development.
Python’s design philosophy emphasizes readability, simplicity, and flexibility, which makes it an
excellent choice for scripting tasks. Below are several reasons why Python is considered one of
the best scripting languages available today:
Python's syntax is clean, straightforward, and highly readable, which makes it easy to learn and
use for both beginners and experienced developers. In Python, code often looks very close to
human language, which reduces the cognitive load on programmers when writing or debugging
scripts. For example, Python uses indentation to define code blocks, rather than curly braces or
keywords, which encourages clear and concise code structure.
Example of Python code for a simple script that reads and prints a file:
python
Copy code
with open("example.txt", "r") as file:
content = file.read()
print(content)
In this example, Python's simplicity allows us to read and print the contents of a file in just a few
lines of code, making it easy for a developer to quickly write scripts for automation tasks.
2. Cross-Platform Compatibility
Python is cross-platform, meaning that scripts written in Python can run on different operating
systems (Windows, macOS, Linux) without modification. This is particularly valuable for
system administration and automating tasks that need to run across multiple platforms.
For instance, a Python script that automates the management of files on a server can be written
on a developer’s local machine and then executed on a remote server regardless of the
underlying operating system.
Python comes with a vast standard library that includes modules for performing a wide variety of
tasks. Whether you need to interact with the file system, send HTTP requests, parse data, or work
with regular expressions, Python’s standard library provides pre-built solutions that make
scripting faster and easier.
• os: For interacting with the operating system (e.g., file management).
• subprocess: For running system commands and managing processes.
Chapter 3
• Encapsulation
• Inheritance
• Polymorphism
• Abstraction
Core Concepts of OOP in Python
1. Class and Object
A class is a blueprint for creating objects. It defines the properties and behaviors of the objects
created from it. An object is an instance of a class. It has the attributes (variables) and methods
(functions) that are defined by the class.
class Dog:
def speak(self):
dog2 = Dog("Bella", 3)
2. Encapsulation: Encapsulation is the concept of bundling the data (attributes) and the methods
that operate on the data into a single unit called a class. It also involves restricting access to some
of the object's components, which can prevent the accidental modification of data. This is usually
done by making attributes private and providing public methods to access them.
In Python, you can encapsulate data by using private attributes (prefix with ) and then create
getter and setter methods:
class Account:
def init (self, owner, balance): self.owner = owner #
Public attribute
self. balance = balance # Private attribute
Python is one of the most popular and versatile programming languages in the world today,
known for its simplicity, readability, and vast ecosystem of libraries and frameworks. Created by
Guido van Rossum in the late 1980s, Python’s evolution has been marked by a combination of
visionary design choices and continuous development. Its history is a fascinating journey that
highlights both the technical aspects and the community-driven nature of its growth.
The Birth of Python
The story of Python begins in December 1989 when Guido van Rossum, a Dutch programmer,
began developing Python at the Centrum Wiskunde & Informatica (CWI) in the Netherlands. At
the time, van Rossum was working on a project called "ABC", a programming language aimed
at beginners that was developed at CWI. Although ABC was simple and powerful, it had
limitations that made it unsuitable for more advanced tasks. Van Rossum, wanting to improve
upon ABC, created Python as a successor.
Python was designed with the goal of being simple, easy to read, and highly extensible. Van
Rossum drew inspiration from ABC, but he also incorporated features from other languages such
as C, Modula-3, and Unix shell scripting. The name "Python" itself was chosen as a tribute to
Monty Python’s Flying Circus, a British comedy series that van Rossum enjoyed watching.
The name was intended to convey a sense of fun and creativity, reflecting the language's goal of
being both easy to use and powerful.
The first version of Python, Python 0.9.0, was released in February 1991. This early version
already contained many features that would become core elements of the language, including:
• Exception handling: Python introduced the ability to catch and handle errors in code
gracefully.
• Functions: Like other programming languages, Python supported functions as building
blocks of code.
• Core data types: The language included basic types like strings, lists, and dictionaries.
Van Rossum also released Python 0.9.0 with some familiar syntax that would make Python
unique, such as the whitespace-based indentation to define code blocks, which later became
one of Python's most defining features. This early version of Python was already structured in
such a way that readability would be a key selling point.
Python 1.0 was officially released in January 1994. By then, the language had already grown in
both features and user base. Python 1.0 introduced several important concepts, including:
Chapter 5
In Python, variables and operators are fundamental concepts that allow you to store and
manipulate data. Understanding how to work with variables and operators is essential for writing
effective and efficient Python code. This article will provide an overview of variables and
operators in Python, including how to use them in different contexts.
1. Variables in Python
What is a Variable?
A variable in Python is a symbolic name for a value. It acts as a reference to data stored in
memory, allowing you to perform operations on it. Python uses variables to store data of various
types, such as numbers, strings, lists, and more.
In Python, you don't need to explicitly declare a variable type before using it. Python is a
dynamically typed language, which means the type of the variable is inferred from the value
assigned to it.
To create a variable, you simply assign a value to a name using the =operator.
python Copy
code
# Variable assignment x = 10
# Integer
name = "Alice" # String is_active =
True # Boolean pi = 3.14159 # Float
1. Valid variable names must start with a letter (A-Z or a-z) or an underscore (_).
2. The rest of the variable name can include letters, digits (0-9), and underscores.
3. Variable names are case-sensitive, meaning myVarand myvarare different.
4. You cannot use Python keywords (reserved words like True, False, None, if, else, etc.)
as variable names.
python Copy
code
valid_name = "John" # Valid name_1 =
"Doe" # Valid
_name = "Alice" # Valid
2. Operators in Python
Operators are symbols used to perform operations on variables and values. Python supports a
wide range of operators, including arithmetic, relational, logical, and more. Here's a breakdown
of different types of operators in Python:
CHAPTER 6
In Python, tuples and lists are both sequence data types that can store collections of
items, but they have some key differences. Let’s go over the main concepts of
each.
1. Tuples
python Copy
code
my_tuple = (1, 2, 3)
python Copy
code
print(my_tuple[0]) # Output: 1
• Methods: Tuples have limited methods compared to lists. Key methods
include:
o count(item): Returns the number of times an item appears in the
tuple.
o index(item): Returns the index of the first occurrence of the item.
• Usage: Tuples are generally used when the data should not change
throughout the program, like coordinates, fixed configuration values, etc.
2. Lists
python Copy
code
my_list = [1, 2, 3]
• Mutability: Lists allow for changes. You can add, remove, or modify
elements.
• Accessing Elements: Like tuples, list elements can also be accessed by
index.
python Copy
code
CHAPTER 9
Python is a versatile, high-level programming language with a wide range of applications. Here’s
an overview of some of the main uses of Python and the concept of scope in Python
programming.
Uses of Python
1. Web Development
a. Python has powerful frameworks like Django, Flask, and FastAPI that make
web development efficient and scalable.
b. These frameworks provide built-in libraries and tools for handling backend
development, data management, and security.
Scope in Python
Chapter 7
Loops and conditional statements
Loops and conditional statements are fundamental components in Python that allow you to
control the flow of your program. Let's go over the basics of each.
1. Conditional Statements
Conditional statements allow you to execute specific blocks of code based on certain conditions.
In Python, the main conditional statements are if, elif, and else.
Syntax:
python
Copy code
if condition:
# code to execute if condition is True
elif another_condition:
# code to execute if another_condition is True
else:
# code to execute if all previous conditions are False
Example:
python
Copy code
age = 18
Explanation:
2. Loops
Loops allow you to repeat a block of code multiple times. Python has two main types of loops:
for loops and while loops. for
Loops
forloops are typically used to iterate over a sequence (like a list, tuple, dictionary, set, or string).
Syntax:
python
Copy code
for item in sequence:
# code to execute for each item in sequence
Example:
python Copy
code
fruits = ["apple", "banana", "cherry"]
Explanation:
This loop will print each fruit in the fruits list one by one. while
Loops
Syntax:
python
Copy code
while condition:
# code to execute as long as condition is True
Example:
python
Copy code
count = 1
Explanation:
This loop will print the numbers 1 through 5. The loop stops when count exceeds 5. Combining
You can also use conditional statements inside loops to create more complex flow control.
Example:
python Copy
code
for number in range(1, 11): if number
% 2 == 0:
print(f"{number} is even") else:
print(f"{number} is odd")
Explanation:
This loop goes through numbers 1 to 10, checking if each number is even or odd and printing the
result.
Functions in Python are reusable blocks of code designed to perform a specific task. They make
code more modular, easier to read, and easier to debug.
To define a function in Python, use the `def` keyword, followed by the function name,
parentheses (with any parameters), and a colon. The code inside the function is indented.
Syntax:
def function_name(parameters):
# code to execute
return result # optional, returns a value
```
python
def greet ():
print ("Hello! Welcome to Python programming.")
To call this function, just write:
Python greet ()
Functions with Parameters
You can pass data to functions by using parameters.
Example:
def greet(name):
print(f"Hello, {name}! Welcome to Python programming.")
greet("Alice")
Output:
```
Hello, Alice! Welcome to Python programming.
```
➢ Functions with Return Values
Sometimes, functions need to return a value after processing.
Example:
def add(a, b):
return a + b
Calling this function:
result = add(5, 3)
print(result)
```
Chapter 10
Small project on cafe billing system
The project “café Billing System” is implemented to reduce the manual work
and enhances the accuracy of work in a restaurant.
Café Billing system is Console Application to Café management. Hence the
project is developed proficiently to help café
. This system wakes to provide service facility to café and owners automate their
BILLING OPERATIONS.
This system entirely reduces the unnecessary time waste inside the café as
well as it reduces unnecessary calculation.
Café Billing system project fully developed in python language which is
currently demanded in market using python GUI Tkinter.
Python is a programming language that lets you work quickly and integrate systems
more efficiently.
Flowchart:
Hardware Requirements:
• Processor – Intel i3 7th generation
• RAM – 4 GB
• System Type – 64-bit windows operating system
• Model – Lenovo Ideapad 310kb
Software Requirements:
• Technologies used - Python 3.6.Python Tkinter GUI
• Language used - Python
Project code:
= Tk()
("700x600")
= PhotoImage(file='bg.png')
= Label(window, image=bg)
label17.place(x=0, y=0)
# function to
calculate the # price
of all the orders def
calculate():
} total
dic.items():
if val[0].get() != "":
total += int(val[0].get())*val[1]
# position it
label16.place(x=20,
y=490) label16.after(3000,
label16.destroy)
#window.after(1000, calculate)
label1 = Label(window,text="Menu",font="times 28
bold",bg="aqua")
label1.place(x=520, y=70)
label2 = Label(window,
text="Espresso \ Rs 30",
font="times 18",bg="brown")
label2.place(x=450, y=120)
label3.place(x=450, y=150)
label4 = Label(window,
18",bg="yellow")
label4.place(x=450, y=180)
label6 = Label(window,
18",bg="red")
label6.place(x=450, y=240)
18",bg="orange")
label7.place(x=450, y=270)
items",font="times
18",bg="#f08080")
label9.place(x=115, y=70)
label10 = Label(window,text="Espresso",font="times
18",bg="brown") label10.place(x=20,
y=120)
e1 = Entry(window) e1.place(x=20,
y=150)
18",bg="blue")
label11.place(x=20, y=200)
e2 = Entry(window) e2.place(x=20,
y=230)
label12.place(x=20, y=280)
e3 = Entry(window)
e3.place(x=20,y=310)
label13 = Label(window,text="Chilli Potato",font="times
18",bg="pink") label13.place(x=20,
y=360)
e4 = Entry(window) e4.place(x=20,
y=390)
label14 = Label(window,text="Chowmein",font="times
18",bg="red") label14.place(x=250,
y=120)
e5 = Entry(window)
e5.place(x=250,
y=150) label15=
Label(window,text=
"black
coffee",font="times
18",bg="orange")
label15.place(x=250, y=200)
e6 = Entry(window)
e6.place(x=250 y=230)
# execute calculate function after 3 second
#window.after(1000, calculate)
b2=Button(window,bg='teal',text="bill",width=30,command=calculate)
b2.place(x=100,y=500)
Time saving: User don’t need to look for menu card, they can directly see
on application.
Demerits:
It doesn’t include input of user details
It doesn’t give user information.
Future Aspect:
This project will Include user details form area.
It will generate bill.
CONCLUSION
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 selfown. 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 2 month. 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.
BOOK:
Think Python by Allen B. downey
WEBSITE:
• www.google.com
• www.slideshare.net
• www.stackoverflow.com