0% found this document useful (0 votes)
173 views49 pages

Python Internship Report

This document is an internship report by Abhishek Sharma on Python Programming, submitted for the Bachelor of Engineering degree at Visvesvaraya Technological University. It details the internship conducted at CodSoft, covering the curriculum, skills acquired, and projects completed, such as a simple calculator and a password generator. The report also includes acknowledgments, a company profile, and insights into the impact of the internship on participants' professional growth.

Uploaded by

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

Python Internship Report

This document is an internship report by Abhishek Sharma on Python Programming, submitted for the Bachelor of Engineering degree at Visvesvaraya Technological University. It details the internship conducted at CodSoft, covering the curriculum, skills acquired, and projects completed, such as a simple calculator and a password generator. The report also includes acknowledgments, a company profile, and insights into the impact of the internship on participants' professional growth.

Uploaded by

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

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

Jnana Sangama , Belagavi , Karnataka_590014

An Internship Report
On

“PYTHON PROGRAMMING”
Submitted in partial fulfilment for the award of the degree of
Bachelor of Engineering In
Electronics & Communication Engineering

Submitted by
ABHISHEK SHARMA
1BI21EC010

Internship Carried Out at

CODSOFT

Under the guidance of


Dr. VIJAYAPRAKASH A.M
PROFESSOR
DEPARTMENT OF ECE, BIT

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING


BANGALORE INSTITUTE OF TECHNOLOGY
K R Road, V.V Puram, Bengaluru-
560004
BANGALORE INSTITUTE OF TECHNOLOGY

K.R. Road, V. V Puram, Bengaluru -560004 Phone:


26613237/26615865, Fax: 22426796
www.bitbangalore.edu.in

Department of Electronics and Communication Engineering

CERTIFICATE

Certified that the Internship / Professional practice work entitled “PYTHON PROGRAMMIN ”
carried out by MR. ABHISHEK SHARMA, bearing USN: 1BI21EC010 a bonafide student of
BANGALORE INSTITUTE OF TECHNOLOGY in partial fulfillment for the award of
Bachelor of Engineering in Electronics and Communication Engineering of the Visvesvaraya
Technological University, Belgaum during the year 2023-2024. It is certified that all corrections
indicated for Internal Assessment have been incorporated in the Report deposited in the
departmental library. The Internship report has been approved as it satisfies the academic
requirements in respect of Internship work prescribed for the said Degree.

Dr. VIJAYAPRAKASH A.M Dr. HEMANTH KUMAR AR


Professor Professor & H.O.D
Dept. of E.C.E. Dept. of E.C.E.

External Viva
Name of the examiners Signature with date
1.
2.
ACKNOWLEDGEMENT

I take this opportunity to express our sincere gratitude and respect to the Bangalore Institute of
Technology, Bangalore for providing us an opportunity to carry out my internship training at
CODSOFT.

I express my sincere regards and thanks to Team Leader, Codsoft for giving necessary advices and
guidance.

With profound sense of gratitude, I acknowledge the guidance and support extended by Dr.
VIJAYAPRAKASH A.M, Professor, Department of Electronics & Communication Engineering,
BIT, Bangalore. Her incessant encouragement and valuable technical sup- port have been of
immense help in realizing this internship training. Her guidance gave us the environment to
enhance our knowledge, skills and to reach the pinnacle with sheer determination, dedication and
hard work.

I would like to thank Dr. VIJAYALAKSHMI, Associate Professor, and Dr.


VIDYASARASWATHI H.N, Assistant Professor, Internship coordinators, Department of
Electronics & Communication Engineering, BIT, Bangalore.

I express my sincere regards and thanks To Dr. HEMANTH KUMAR AR, Professor and HOD,
Electronics & Communication Engineering, BIT and Dr. M U ASWATH, Principal, BIT,
Bangalore, for their encouragement and support throughout the internship work.

I also extend our thanks to the entire faculty of the Department of ECE, BIT, Bangalore, who have
encouraged me throughout the course of bachelor degree.

ABHISHEK SHARMA
(1BI21EC010)
ABSTRACT

This report presents an in-depth analysis of the Python Programming internship conducted by
CodSoft, aimed at providing aspiring programmers with hands-on experience in Python development.
CodSoft's internship program is meticulously designed to equip participants with essential skills and
practical knowledge in Python, catering to both beginners and intermediate-level learners.

The report delves into the structure and curriculum of the internship, outlining the core topics covered,
such as data structures, algorithms, web development, and application of Python in various domains. It
evaluates the effectiveness of the teaching methodologies, including lectures, practical exercises, and
real-world projects, fostering a holistic learning environment.

Furthermore, the report assesses the impact of the internship on participants' skill development,
professional growth, and their ability to apply Python concepts in real-world scenarios. Testimonials
and feedback from interns provide valuable insights into the program's strengths and areas for
improvement.

Overall, this report serves as a comprehensive overview of the Python Programming internship at
CodSoft, offering insights into its structure, content, and the valuable experiences gained by the
interns, while suggesting recommendations for enhancing the program's effectiveness.
BANGALORE INSTITUTE OF TECHNOLOGY

VISION

To establish and develop the Institute as a center of higher learning, ever abreast with ex-
panding horizon of knowledge in the field of engineering and technology, with entrepre- neurial
thinking, leadership excellence for life-long success and solve societal problem.

MISSION

• Provide high quality education in the engineering disciplines from the under graduate
through doctoral levels with creative academic and professional programs.
• Develop the Institute as a leader in Science, Engineering, Technology and management,
Research and apply knowledge for the benefit of society.
• Establish mutual beneficial partnerships with industry, alumni, local, state and central
governments by public service assistance and collaborative research.
• Inculcate personality development through sports, cultural and extra curricular
activities and engage in the social, economic and professional challenges.

LONG TERM GOALS

• To be among top 3 private engineering colleges in Karnataka and top 20 in India.

• To be the most preferred choice of students and faculty.

• To be the preferred partner of corporate.

• To provide knowledge through education and research in engineering.

• To develop in each student mastery of fundamentals, versatility of mind, motivation for learn-
ing, intellectual discipline and self-reliance which provide the best foundation for continuing
professional achievement.

• To provide a liberal; as well as a professional education so that each student acquires a respect
for moral values, a sense of their duties as a citizen, a feeling for taste and style.
DEPARTMENT OF ELECTRONICS AND COMMUNICATION

VISION

Imparting Quality Education to achieve Academic Excellence


in Electronics and Communication Engineering for Global
Competent Engineers.

MISSION

• Create state of art infrastructure for quality education.

• Nurture innovative concepts and problem solving skills.

• Delivering Professional Engineers to meet the societal needs.

PROGRAM EDUCATIONAL OBJECTIVES

 Prepare graduates to be professionals, Practicing engineers and


entrepreneurs in the field of Electronics and communication.

 To acquire sufficient knowledge base for innovative techniques


in design and development of systems.

 Capable of competing globally in multidisciplinary field.

 Graduates will maintain and improve technical competence through


continuous learning process.

PROGRAM SPECIFIC OUTCOMES

PSO1: Core Engineering: The graduates will be able to apply the principles of
Electronics and Communication in core areas.
PSO2: Soft Skills: An ability to use latest hardware and software tools in
Electronics and Communication engineering.
PSO3: Successful Career: Preparing Graduates to satisfy industrial needs.
COURSE OUTCOMES OF 21INT68

After going through the internship the student is able to:

CO1:Apply engineering and management principles.

CO2:Analyze real-time problems and suggest alternate solutions.


CO3:Communicate effectively and work in teams.

CO4:Inbibe the practice of professional ethics and need for lifelong learning.

CO TO PO & PSO MAPPING

PO PO PO PO PO PO PO PO PO P0 PO PO PSO PSO PSO


1 2 3 4 5 6 7 8 9 10 11 12 1 2 3

CO H M H M --- M ---- --- --- L --- --- H --- H


1

CO --- H --- H M M --- L --- --- --- --- L L L


2

CO --- --- --- --- L --- M H H H --- --- ---- M ---


3

CO --- --- --- --- L --- H --- --- M H H M H M


4
Table of Contents

CHAPTER CONTENTS PAGE NUMBER


CHAPTER 1: PROFILE OF THE ORGANIZATION 11-15

11
1.1 Introduction

1.2 Company Strategy 12

1.3 Company Division 13

1.5 Company major products 13

1.6 Organization Structure 13

1.7 Business partners 13

1.8 Roles and responsibilities 14

1.9 Company achievements 15

CHAPTER 2: ABOUT PYTHON 16-22

2.1 The Evolution and Technology Background of 16-19


Python
2.2 Zen of Python 20
2.3 Python vs Other Programming Languages 21
2.4 Python Functions 22

CHAPTER 3: TASKS PERFORMED 23-38

3.1 Simple Calculator 23-33


3.2 Password Generator 34-35
3.3 Rock, Paper and Scissor Game 36-38
CHAPTER 4: REFLECTION NOTES 39-46

6.1 Skills Acquired 39-40


6.2 Challenges Faced and Overcoming 41-42
6.3 Lessons Learned 43
6.4 Conclusion 44

6.5 References 45
6.6 CO, PO and PSO Justification 46
PYTHON PROGRAMMING 2023-2024

CHAPTER 1

PROFILE OF THE ORGANIZATION


1.1 INTRODUCTION

CODSOFT is a vibrant and diverse community that brings together individuals with similar
objectives and ultimate goals. Our main focus is on creating opportunities that span various areas,
including leadership development, learning, student engagement, and fostering shared interests.

Codsoft stands as a dynamic institution dedicated to empowering individuals in the realm of


programming and software development. With a core focus on Python programming, Codsoft offers
comprehensive educational programs and internships designed to equip participants with practical
skills and industry-relevant knowledge.

Through its Python Programming internship, Codsoft cultivates a rich learning environment,
emphasizing hands-on projects and mentorship. This approach enables interns to delve deep into
Python's applications, from creating basic tools like calculators and to-do lists to addressing
cybersecurity with password generators.

The institution's impact extends beyond education, fostering a collaborative and innovative
community of developers. Codsoft's commitment to staying abreast of industry trends ensures that
participants receive current and applicable knowledge, aligning their skills with the demands of the
ever-evolving tech landscape.

Codsoft's emphasis on practical skills, collaboration, and industry alignment positions it as a beacon
of learning and growth in the programming sphere. Through its programs, it continues to shape
adept programmers, fostering a culture of innovation and excellence in software development.

Department of Electronics and Communication Engineering, BIT PAGE 12


PYTHON PROGRAMMING 2023-2024

1.2 COMPANY STRATEGY

PURPOSE
Codsoft's purpose typically encapsulates its fundamental reason for
existenceand its broader mission in the software industry.

MISSION STATEMENT
Software development is an iterative process, and the mission includes continually improving
software solutions. This entails gathering feedback, identifying areas for enhancement, and
implementing updates to make the software more efficient, user-friendly, and reliable.
Continuous improvement also involves staying up to date with the latest technologies, tools, and
industry trends.

VISION
The vision of software development is to create innovative solutions that push the boundaries
of technology. This involves leveraging emerging technologies, exploring new ideas, and
developing software that brings novel approaches to solving problems and improving the lives
of users.

GUIDING VALUES
Codsoft's guiding values typically reflect its principles and philosophies in software
development and business practices.

Department of Electronics and Communication Engineering, BIT PAGE 13


PYTHON PROGRAMMING 2023-2024

1.3 COMPANY DIVISION


CodSoft's major divisions include IT services and consultancy, web and mobile app
development, and e-commerce development. They also run extensive internship programs and
offer recruitment services. These divisions work together to deliver comprehensive IT
solutions and practical training opportunities.

1.4 COMPANY MAJOR SERVICE

CodSoft's major services focus on IT consultancy and innovative technology solutions, with a
strong emphasis on web and mobile app development.

1.5 BUSINESS PARTNERS

TEKLYNX
https://www.teklynx.com/en/partners/partner-programs

1.6 ORGANIZATION STRUCTURE

The company is led by its directors, Sathaiah Shenam and Charan Kumar Reddy Chemikala,
who oversee its strategic direction and operations. CodSoft’s team includes industry experts
dedicated to providing innovative solutions and practical training through their internship
programs.

1.7 BOARD OF DIRECTORS


1. Sathaiah Shenam

2. Charan Kumar Reddy Chemikala

Corporate Officers

Lokenath bose garden lane Kolkata,West Bengal


[email protected]

Department of Electronics and Communication Engineering, BIT PAGE 14


PYTHON PROGRAMMING 2023-2024

1.8 ROLES AND RESPONSIBILITIES

My role within the Codsoft Python Programming internship was a transformative exploration into
the world of software development, marked by active involvement in crafting three impactful
projects. As an intern, I embarked on a journey of continuous learning, leveraging Python's
versatility to create functional and purpose-driven applications.

Initially, the role encompassed the development of the Simple Calculator, a project that introduced
me to fundamental Python concepts. Implementing arithmetic operations and designing a user-
friendly interface honed my skills in logic implementation and user interaction design.

Transitioning to the To-Do List application further solidified my role. Collaborating with peers, I
contributed to designing an intuitive task management interface, integrating database functionalities,
and ensuring seamless user interaction. This project expanded my understanding of database
integration and enhanced my proficiency in creating user-centric applications.

The culmination of my internship role materialized in the creation of the Password Generator
project. Focused on cybersecurity, this endeavor involved crafting a tool to generate secure and
randomized passwords. Implementing stringent security measures and user-defined criteria fortified
my knowledge in encryption algorithms and emphasized the significance of password security.

Throughout this role, I immersed myself in a culture of learning, collaborating with peers, and
absorbing guidance from mentors. Engaging with structured learning modules and practical
application reinforced my Python skills and nurtured a problem-solving mindset essential in
software development.

My role as an intern at Codsoft not only cultivated technical expertise but also instilled a deep
appreciation for the iterative nature of programming. It shaped me into an adaptable and resilient
learner, equipped to navigate the evolving landscape of technology. This experience propelled me
forward, igniting a passion for programming and a solid foundation to thrive in future endeavors
within the realm of software development.

Department of Electronics and Communication Engineering, BIT PAGE 15


PYTHON PROGRAMMING 2023-2024

1.9 COMPANY ACHIVEMENTS

CodSoft's achievements are multifaceted, emphasizing practical education and community building.
Key achievements include:

1. Internship Programs: CodSoft offers intensive internships in web development, mobile app
development, data science, AI, and more. These programs are designed to provide hands-on
experience with real-world projects, enhancing the skills of participants.
2. Community Growth: CodSoft has built a large online community with over 240K followers on
LinkedIn, 90K on Facebook, 20K on Instagram, and 6K on Telegram, fostering a network of tech
enthusiasts and professionals.
3. Client Services: They deliver high-quality IT solutions, including website development and e-
commerce platforms, ensuring 100% user satisfaction.

Department of Electronics and Communication Engineering, BIT PAGE 16


PYTHON PROGRAMMING 2023-2024

CHAPTER 2

ABOUT PYTHON

The Evolution and Technology Background


of Python
Introduction:
Python, a versatile and high-level programming language, has evolved
into a cornerstone of modern software development since its inception in
the late 1980s by Guido van Rossum. Its simplicity, readability, and
powerful capabilities have made it a preferred choice for programmers across various
domains.

Core Features and Philosophy:


Python's design philosophy revolves around readability and simplicity. Its syntax
emphasizes readability by utilizing indentation and clean structures. allowing developers to
express complex ideas in fewer lines of code compared to other languages. This simplicity,
combined with its dynamic typing and automatic memory management, reduces the e time
needed for coding and debugging, enhancing productivity.

Language Evolution:
Python has seen several major releases, with the most significant branches being Python 2x
and Python 3x. Python 2.x, introduced in 2000, was widely adopted, but its limitations
prompted the development of Python 3.x in 2000. The transition from Python 2.x x to
Python 3.a laced challenges due to backward-incompatible changes, but Python 3.x
brought essential improvements, including better Unicode support, enhanced syntax, and
overall language consistency.

Application Domains:
Python's versatility spons across various application domains. In weh development,
frameworks like Django and Flask provide robust tools for building scalable and efficient
web applications. Additionally. Python's libraries and tools, such as Numpy, Pandas, and
Matplotlih, have positioned it as a leading language for data analysis, scientific computing,
and visualization. Its use in artificial intelligence (Al), machine learning (MI.). and natural
language processing (NLP) has surged due to libraries like TensorFlow. Keras, and NLTK,
making Python a primary language for Al- related tasks.

Department of Electronics and Communication Engineering, BIT PAGE 17


PYTHON PROGRAMMING 2023-2024

Community and Ecosystem:

Python's success is further fueled by its vibrant and welcoming community. The Python
Software Foundation (PSF) oversees the language's development, organizes events, and
fosters community initiatives. The community's collaborative spirit has led to an extensive
ecosystem with numerous third-party libraries and frameworks. The Python Package Index
(PyPI) serves as a centralized repository for Python packages, enabling developers to easily
access and share code, contributing to the language's growth and versatility.

Performance and Implementations:

Initially, Python was criticized for its performance in computationally. intensive tasks.
However, various implementations and optimization techniques have addressed these
concerns. PyPy, an alternative implementation of Python, employs a just-in-time (IIT)
compiler. significantly improving performance. Python allows Python code to run on the
Java Virtual Machine (IVM), providing seamless integration with Java applications.
Python, a static compiler for Python, allows developers to write C extensions directly
within Python, enhancing performance for critical sections of code.

Industry Adoption and Trends:

Python's adoption in industries such as finance, healthcare, academia, and technology has
surged due to its ease of use and versatility. Its role in data science, particularly in handling
big data and machine learning applications, has made it indispensable. Additionally. its
readability and simplicity make Python an excellent language for teaching programming to
beginners, contributing to its sustained popularity.

Here are some points that delve deeper into the technology background of Python:

1. Simplicity and Readability:

Python's syntax and design prioritize readability and simplicity. making it easy for
developers to write and maintain code.

2. Dynamic Typing and Automatic Memory Management:

Its dynamic typing allows for flexible variable assignments, while automatic memory
management via garbage collection simplifies memory handling.

3. Major Releases - Python 2.x vs. Python 3.x:

Python 2.x. popular for years, faced its end-of-life in 2020 due to several limitations,
prompting the transition to Python 3.x. Python 3.x introduced significant improvements
like better Unicode support, enhanced syntax, and improved consistency.

Department of Electronics and Communication Engineering, BIT PAGE 18


PYTHON PROGRAMMING 2023-2024

4. Application Domains - Web Development:

Frameworks like Django and Flask provide robust tools for building web applications with
scalability and efficiency.

5. Application Domains-Data Analysis and Scientific

Computing:

Python's libraries such as NumPy, Pandas, and Matplotlib have positioned it as a leading
language for data analysis, visualization, and scientific computing.

6. Application Domains AI, MI., and NLP:


Libraries like TensorFlow, Keras, and NLTK have propelled Python's usage in artificial
intelligence, machine learning, and natural language processing tasks.

7. Community and Collaboration:

The Python Software Foundation (PSF) oversees Python's development and fosters a
supportive community that encourages collaboration.

The Python Package Index (PyPI) serves as a centralized repository. promoting sharing and
accessibility of Python packages,

8. Performance Challenges and Solutions:

Initially criticized for performance in computationally intensive tasks, alternative


implementations like PyPy with JIT compilation. have significantly improved
performance.

Python enables the writing of C extensions directly in Python. enhancing performance for
critical sections of code.

9. Industry Adoption and Trends:

Python's adoption spans across diverse industries, including finance, healthcare, academia,
and technology. Its role in handling big data, machine learning, and Al applications has
made it indispensable in these domains.

10. Education and Teaching:

Python's readability and simplicity make it an excellent language for teaching


programming to beginners, contributing to its sustained popularity.

11. Continual Evolution and Updates:

Department of Electronics and Communication Engineering, BIT PAGE 19


PYTHON PROGRAMMING 2023-2024

Python continues to evolve with regular updates and improvements, maintaining its
relevance in a rapidly changing technological landscape.

12. Cross-platform Compatibility:

Python's cross-platform nature allows code written in Python to run seamlessly across
various operating systems, enhancing its versatility.

13. Ease of Integration:

Its ability to easily integrate with other languages like C/C++, Java. and .NET expands its
functionality and usage in different environments.

14. Contributions to Open Source Community:

Python's open-source nature encourages contributions, fostering innovation and a


collaborative spirit
within the programming community.

15. Corporate Support and Endorsements:

Many prominent tech companies, including Google, Facebook, and Amazon, endorse
Python and actively use it in their systems and products, contributing to its widespread
adoption. This detailed breakdown explores Python's strengths, applications, challenges,
community support, and the factors contributing to its widespread use in various industries
and educational settings.

Department of Electronics and Communication Engineering, BIT PAGE 20


PYTHON PROGRAMMING 2023-2024

Zen of Python
Python's design philosophy is documented in the Zen of Python. It consists of nineteen
aphorisms such as −

 Beautiful is better than ugly


 Explicit is better than implicit
 Simple is better than complex
 Complex is better than complicated

To obtain the complete Zen of Python document, type import this in the Python Shell −

>>>import this

This will produce following 19 aphorisms -

Beautiful is better than ugly.


Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

Department of Electronics and Communication Engineering, BIT PAGE 21


PYTHON PROGRAMMING 2023-2024

Python vs. Other Programming Languages


Here’s a comparison of Python with the programming languages C, C++, and Java in a
table format:

Department of Electronics and Communication Engineering, BIT PAGE 22


PYTHON PROGRAMMING 2023-2024

Python Functions
Python Functions is a block of statements that return the specific task. The idea is to put
some commonly or repeatedly done tasks together and make a function so that instead of
writing the same code again and again for different inputs, we can do the function calls to
reuse code contained in it over and over again.

Some Benefits of Using Functions

 Increase Code Readability

 Increase Code Reusability

Python Function Declaration


The syntax to declare a function is:

Syntax of Python Function Declaration

Types of Functions in Python

Below are the different types of functions in Python:

 Built-in library function: These are Standard functions in Python that are available to use.

 User-defined function: We can create our own functions based on our requirements.

Creating a Function in Python

Department of Electronics and Communication Engineering, BIT PAGE 23


PYTHON PROGRAMMING 2023-2024

We can define a function in Python, using the def keyword. We can add any type of
functionalities and properties to it as we require. By the following example, we can
understand how to write a function in Python. In this way we can create Python function
definition by using def keyword.

# A simple Python function


def fun():
print("Welcome to GFG")

Calling a Function in Python


After creating a function in Python we can call it by using the name of the functions
Python followed by parenthesis containing parameters of that particular function. Below is
the example for calling def function Python.

# A simple Python function


def fun():
print("Welcome to GFG")

# Driver code to call a function


fun()

Output:

Welcome to GFG

Python Function with Parameters


If you have experience in C/C++ or Java then you must be thinking about the return type
of the function and data type of arguments. That is possible in Python as well (specifically
for Python 3.5 and above).

Python Function Syntax with Parameters

def function_name(parameter: data_type) -> return_type:


"""Docstring"""
# body of the function
return expression

The following example uses arguments and parameters that you will learn later in this
article so you can come back to it again if not understood.

def add(num1: int, num2: int) -> int:


"""Add two numbers"""
num3 = num1 + num2

return num3

Department of Electronics and Communication Engineering, BIT PAGE 24


PYTHON PROGRAMMING 2023-2024

# Driver code
num1, num2 = 5, 15
ans = add(num1, num2)
print(f"The addition of {num1} and {num2} results {ans}.")

Output:

The addition of 5 and 15 results 20.

Note: The following examples are defined using syntax 1, try to convert them in syntax 2
for practice.

# some more functions


def is_prime(n):
if n in [2, 3]:
return True
if (n == 1) or (n % 2 == 0):
return False

r = 3

Output: while r * r <= n:


if n % r == 0:
return False
r += 2
return True
print(is_prime(78), is_prime(79))

False True

Python Function Arguments


Arguments are the values passed inside the parenthesis of the function. A function can
have any number of arguments separated by a comma.

In this example, we will create a simple function in Python to check whether the number
passed as an argument to the function is even or odd.

# A simple Python function to check


# whether x is even or odd
def evenOdd(x):
if (x % 2 == 0):
print("even")
else:
print("odd")

# Driver code to call the function

Department of Electronics and Communication Engineering, BIT PAGE 25


PYTHON PROGRAMMING 2023-2024

evenOdd(2)
evenOdd(3)

Output:

even
odd

Types of Python Function Arguments


Python supports various types of arguments that can be passed at the time of the function
call. In Python, we have the following function argument types in Python:

Default Arguments
A default argument is a parameter that assumes a default value if a value is not provided in
the function call for that argument. The following example illustrates Default arguments to
write functions in Python.

# Python program to demonstrate


# default arguments
def myFun(x, y=50):
print("x: ", x)
print("y: ", y)

# Driver code (We call myFun() with only


# argument)
myFun(10)

Output:

x: 10
y: 50

Like C++ default arguments, any number of arguments in a function can have a default
value. But once we have a default argument, all the arguments to its right must also have
default values.

Keyword Arguments
The idea is to allow the caller to specify the argument name with values so that the caller
does not need to remember the order of parameters.

# Python program to demonstrate Keyword Arguments


def student(firstname, lastname):
print(firstname, lastname)

Department of Electronics and Communication Engineering, BIT PAGE 26


PYTHON PROGRAMMING 2023-2024

# Keyword arguments
student(firstname='Geeks', lastname='Practice')
student(lastname='Practice', firstname='Geeks')

Output:

Geeks Practice
Geeks Practice

Positional Arguments
We used the Position argument during the function call so that the first argument (or value)
is assigned to name and the second argument (or value) is assigned to age. By changing the
position, or if you forget the order of the positions, the values can be used in the wrong
places, as shown in the Case-2 example below, where 27 is assigned to the name and Suraj
is assigned to the age.

def nameAge(name, age):


print("Hi, I am", name)
print("My age is ", age)

# You will get correct output because


# argument is given in order
print("Case-1:")
nameAge("Suraj", 27)
# You will get incorrect output because
# argument is not in order
print("\nCase-2:")
nameAge(27, "Suraj")

Output:

Case-1:
Hi, I am Suraj
My age is 27
Case-2:
Hi, I am 27
My age is Suraj

Arbitrary Keyword Arguments


In Python Arbitrary Keyword Arguments, *args, and **kwargs can pass a variable number
of arguments to a function using special symbols. There are two special symbols:

 *args in Python (Non-Keyword Arguments)

 **kwargs in Python (Keyword Arguments)

Department of Electronics and Communication Engineering, BIT PAGE 27


PYTHON PROGRAMMING 2023-2024

Example 1: Variable length non-keywords argument

# Python program to illustrate


# *args for variable number of arguments
def myFun(*argv):
for arg in argv:
print(arg)

myFun('Hello', 'Welcome', 'to', 'GeeksforGeeks')

Output:

Hello
Welcome
to
GeeksforGeeks

Example 2: Variable length keyword arguments

# Python program to illustrate


# *kwargs for variable number of keyword arguments

def myFun(**kwargs):
for key, value in kwargs.items():

print("%s == %s" % (key, value))

# Driver code
myFun(first='Geeks', mid='for', last='Geeks')

Output:

first == Geeks
mid == for
last == Geeks

Python Function within Functions


A function that is defined inside another function is known as the inner function or nested
function. Nested functions can access variables of the enclosing scope. Inner functions are
used so that they can be protected from everything happening outside the function.

# Python program to
# demonstrate accessing of

Department of Electronics and Communication Engineering, BIT PAGE 28


PYTHON PROGRAMMING 2023-2024

# variables of nested functions

def f1():
s = 'I love GeeksforGeeks'

def f2():
print(s)

f2()

# Driver's code
f1()

Output:

I love GeeksforGeeks

Anonymous Functions in Python


In Python, an anonymous function means that a function is without a name. As we already
know the def keyword is used to define the normal functions and the lambda keyword is
used to create anonymous functions.

# Python code to illustrate the cube of a number


# using lambda function
def cube(x): return x*x*x

cube_v2 = lambda x : x*x*x

print(cube(7))
print(cube_v2(7))

Output:

343
343

Recursive Functions in Python


Recursion in Python refers to when a function calls itself. There are many instances when
you have to build a recursive function to solve Mathematical and Recursive Problems.

Department of Electronics and Communication Engineering, BIT PAGE 29


PYTHON PROGRAMMING 2023-2024

Using a recursive function should be done with caution, as a recursive function can become
like a non-terminating loop. It is better to check your exit statement while creating a
recursive function.

def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n - 1)

print(factorial(4))

Output

24

Here we have created a recursive function to calculate the factorial of the number. You can
see the end statement for this function is when n is equal to 0.

Return Statement in Python Function


The function return statement is used to exit from a function and go back to the function
caller and return the specified value or data item to the caller. The syntax for the return
statement is:

return [expression_list]

The return statement can consist of a variable, an expression, or a constant which is


returned at the end of the function execution. If none of the above is present with the return
statement a None object is returned.

Example: Python Function Return Statement

def square_value(num):
"""This function returns the square
value of the entered number"""
return num**2

print(square_value(2))
print(square_value(-4))

Output:

4
16

Department of Electronics and Communication Engineering, BIT PAGE 30


PYTHON PROGRAMMING 2023-2024

Pass by Reference and Pass by Value


One important thing to note is, in Python every variable name is a reference. When we pass
a variable to a function Python, a new reference to the object is created. Parameter passing
in Python is the same as reference passing in Java.

# Here x is a new reference to same list lst


def myFun(x):
x[0] = 20

# Driver Code (Note that lst is modified


# after function call.
lst = [10, 11, 12, 13, 14, 15]
myFun(lst)
print(lst)

Output:

[20, 11, 12, 13, 14, 15]

When we pass a reference and change the received reference to something else, the
connection between the passed and received parameters is broken. For example, consider
the below program as follows:

def myFun(x):

# After below line link of x with previous


# object gets broken. A new object is assigned
# to x.
x = [20, 30, 40]

# Driver Code (Note that lst is not modified


# after function call.
lst = [10, 11, 12, 13, 14, 15]
myFun(lst)
print(lst)

Output:

[10, 11, 12, 13, 14, 15]

Another example demonstrates that the reference link is broken if we assign a new value
(inside the function).

def myFun(x):

# After below line link of x with previous


# object gets broken. A new object is assigned

Department of Electronics and Communication Engineering, BIT PAGE 31


PYTHON PROGRAMMING 2023-2024

# to x.
x = 20

# Driver Code (Note that x is not modified


# after function call.
x = 10
myFun(x)
print(x)

Output:

10

Exercise: Try to guess the output of the following code.

def swap(x, y):


temp = x
x = y
y = temp

# Driver code
x = 2
y = 3
swap(x, y)
print(x)
print(y)

Output:

2
3

Department of Electronics and Communication Engineering, BIT PAGE 32


PYTHON PROGRAMMING 2023-2024

Chapter 3:

TASKS PERFORMED

Project Modules

(1) Project Module: Simple Calculator

Introduction:
The Simple Calculator project aimed to create a versatile and user-friendly tool for basic
arithmetic operations. The project was designed as an entry- level application to introduce
interns to fundamental programming concepts while addressing the need for a
straightforward calculator application.

Objective:
The primary objective of the Simple Calculator project was to develop a functional
calculator application using Python that could perform essential arithmetic operations like
addition, subtraction, multiplication, and division. It sought to provide users with a
minimalist yet efficient tool for basic calculations.

Key Features:
Basic Arithmetic Operations: The calculator allowed users to perform addition,
subtraction, multiplication, and division of numbers.

User-Friendly Interface: A simple and intuitive user interface was designed, enabling
users to input operands and perform calculations easily.

Error Handling: The application incorporated robust error handling to manage scenarios
like division by zero or invalid input.

Development Process:

Design Phase: The project started with conceptualizing the interface layout and
functionality required for the calculator.

Implementation: Interns utilized Python's core functionalities to implement the


calculator's operations, focusing on modular code design.

Department of Electronics and Communication Engineering, BIT PAGE 33


PYTHON PROGRAMMING 2023-2024

User Interface Design: The interface was designed using Python libraries like Tkinter,
ensuring a clean and accessible layout for user interaction.

Functionality Testing: Rigorous testing was conducted to validate the accuracy of


arithmetic operations and to identify and resolve any potential bugs.

Department of Electronics and Communication Engineering, BIT PAGE 34


PYTHON PROGRAMMING 2023-2024

Program Code for Simple Calculator:


#Simple Calculator

def add(x,y):
return x+y

def subtract(x,y):
return x-y

def multiply(x,y):
return x*y

def divide(x,y):
if(y==0):
print("Not defined")
else:
return x/y

print("Select operation")
print("1.Add")
print("2.Subtract")
print("3.Multiply")
print("4.Divide")

while(True):

choice=input("Enter choice(1/2/3/4):")

if(choice=='1' or choice=='2' or choice=='3' or choice=='4'):


num1=float(input("Enter first number:"))
num2=float(input("Enter second number:"))

if(choice=='1'):
print(num1,"+", num2,"=", add(num1,num2))

elif(choice=='2'):
print(num1,"-", num2,"=", subtract(num1,num2))

elif(choice=='3' and num2!=0):


print(num1,"*", num2,"=", multiply(num1,num2))

elif(choice=='4'):
print(num1,"/", num2,"=", divide(num1,num2))

Department of Electronics and Communication Engineering, BIT PAGE 35


PYTHON PROGRAMMING 2023-2024

else:
print("Invalid Input")

continue

Output:

Conclusion:

The Simple Calculator project module served as an entry point into Python application
development. It provided interns with hands-on experience in implementing core
arithmetic operations, user interface design, and error handling in Python. Through this
project, interns gained practical insights into the development process, reinforcing their
understanding of fundamental programming concepts.

Department of Electronics and Communication Engineering, BIT PAGE 36


PYTHON PROGRAMMING 2023-2024

(2) Project Module: Password Generator

Introduction:

The Password Generator project aimed to address the increasing need for strong and
unique passwords in today's digital landscape. It focused on creating a Python-based tool
capable of generating secure passwords with specific criteria, enhancing user security in
various online platforms.

Objective:

The primary objective of the Password Generator project was to develop a tool that could
generate strong and customizable passwords to improve cybersecurity. It aimed to provide
users with a secure way to generate complex passwords meeting specific length and
complexity requirements.

Key Features:

Customizable Password Criteria: Users could specify password length and select criteria
such as uppercase letters, lowercase letters, numbers, and special characters.

Randomized Password Generation: The application utilized Python's random module to


generate unique and unpredictable passwords.

Secure Passwords: The generated passwords complied with recommended security


standards, ensuring robustness against common password attacks.

Development Process:

Design Phase: The project began with outlining user requirements and specifying criteria
for password generation.

Implementation: Interns implemented password generation logic in Python, incorporating


user-defined criteria to create randomized passwords.

User Interface Development: An intuitive user interface was designed to enable users to
input preferences and generate passwords easily.

Testing and Validation: Rigorous testing was conducted to validate the randomness,
strength, and compliance of the generated passwords.

Department of Electronics and Communication Engineering, BIT PAGE 37


PYTHON PROGRAMMING 2023-2024

Program Code for Password Generator:


#Password Generator

import random
passlen=int(input("enter the length of password:"))
s="abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXY
Z!@#$%^&*()?"
p="".join(random.sample(s,passlen))
print(p)

Output:

Conclusion:
The Password Generator project module served as an essential tool to educate interns about
cybersecurity practices and password security. It provided hands-on experience in
implementing secure password generation algorithms and user interface design. Through
this project, interns gained insights into the importance of creating strong passwords to
safeguard digital assets.

Department of Electronics and Communication Engineering, BIT PAGE 38


PYTHON PROGRAMMING 2023-2024

(3) Project Module: Rock, Paper and Scissor Game

Introduction:

Rock, Paper, Scissors is a classic hand game played between two people, where each
player simultaneously forms one of three shapes with an outstretched hand: rock (a closed
fist), paper (an open hand), or scissors (a fist with the index and middle fingers extended,
forming a V). The game has simple rules: rock crushes scissors, scissors cuts paper, and
paper covers rock. If both players choose the same shape, the game is a tie.

Key Features:

1. User Interaction: Players can interact with the game by entering their choice of rock,
paper, or scissors through the command line interface.
2. Random Computer Choice: The computer generates a random choice (rock, paper, or
scissors) to compete against the player.
3. Winner Determination: A function compares the player’s choice with the computer’s
choice to determine and display the winner of each round.
4. Game Loop: The game continues until the player decides to quit by entering 'q',
providing a continuous and interactive experience.
5. Error Handling: Basic validation ensures that the player's input is restricted to the valid
choices (rock, paper, scissors), prompting for re-entry if an invalid choice is detected.

Objectives:
 Practice Basic Programming Concepts: It reinforces concepts such as loops,
conditionals, functions, and handling user input in Python.
 Introduction to Randomness: Introduces the concept of randomness and its application
in generating computer choices.
 Interactive Gameplay: Provides a fun and interactive environment where players can
compete against the computer in a simple game.
 Error Handling: Implements basic error handling to improve user experience by
validating user inputs.

Department of Electronics and Communication Engineering, BIT PAGE 39


PYTHON PROGRAMMING 2023-2024

Program Code for Rock, Paper and Scissor Game:


#Rock beats scissor, scissor beat paper, and paper beats rock.

import random

game=["rock","paper","scissor"]

while(True):
user=str(input("Choose b/w rock, paper or scissor:"))
if(user=='rock' or user=='paper' or user=='scissor'):
computer=random.sample(game,1)
print("computer:",computer)

if(user=='rock'):
if(computer==['scissor']):
print("winner:user")

elif(computer==['paper']):
print("winner:computer")

else:
print("winner:Draw")

elif(user=='paper'):
if(computer==['scissor']):
print("winner:computer")

elif(computer==['rock']):
print("winner:user")

else:
print("winner:Draw")

elif(user=='scissor'):
if(computer==['paper']):
print("winner:user")

elif(computer==['rock']):
print("winner:computer")

else:
print("winner:Draw")

Department of Electronics and Communication Engineering, BIT PAGE 40


PYTHON PROGRAMMING 2023-2024

else:
print("Invalid Input")

continue

ans=str(input("Want to play more(Yes/No):"))


if(ans=='No'):
break

Output:

Department of Electronics and Communication Engineering, BIT PAGE 41


PYTHON PROGRAMMING 2023-2024

CHAPTER 4

REFLECTION NOTES

Skills Acquired
During the Codsoft Python Programming internship, I acquired a comprehensive set of
technical, collaborative, and problem-solving skills that significantly enhanced my
proficiency in software development:

Technical Skills:

1. Python Proficiency: Mastered Python programming fundamentals, including syntax,


data structures, and libraries, enabling me to develop functional applications.

2. User Interface (UI) Design: Gained expertise in designing intuitive and user-friendly
interfaces using Python libraries like Tkinter, enhancing user experience.

3. Database Integration: Acquired skills in integrating databases within Python


applications, enabling efficient data storage and retrieval.

4. Algorithm Implementation: Implemented algorithms for password generation, enhancing


my understanding of security practices and randomization techniques.

5. Error Handling: Implemented robust error-handling mechanisms, ensuring smooth user


experiences and minimizing application disruptions.

Collaboration and Communication Skills:

1. Team Collaboration: Worked collaboratively with peers on projects, fostering effective


teamwork and shared problem-solving.

2. Mentorship and Guidance: Engaged with mentors to seek guidance, developing effective
communication and learning to leverage expertise.

3. Feedback Incorporation: Adapted to constructive feedback, honing the ability to iterate


and improve project outcomes iteratively.

Problem-solving and Adaptability:

1. Analytical Thinking: Developed analytical thinking to approach complex problems,


breaking them down into manageable components for solutions.

Department of Electronics and Communication Engineering, BIT PAGE 42


PYTHON PROGRAMMING 2023-2024

2. Adaptability: Adapted quickly to new concepts, tools, and methodologies introduced


during the internship, showcasing flexibility in learning.

3. Iterative Development: Embraced iterative development processes, understanding the


importance of continuous improvement in project outcomes.

Project Management:

1. Task Prioritization: Learned to prioritize tasks effectively, managing project timelines


and ensuring milestones were met.

2. Project Planning: Contributed to project planning phases, understanding the importance


of comprehensive planning for successful outcomes.

Soft Skills:

1. Time Management: Efficiently managed time to meet project deadlines while balancing
learning and development.

2. Critical Thinking: Enhanced critical thinking abilities, allowing for the identification of
optimal solutions and problem-solving approaches.

These skills collectively enriched my experience during the internship, empowering me not
only as a proficient Python programmer but also as a collaborative team member with a
robust problem-solving acumen.

Department of Electronics and Communication Engineering, BIT PAGE 43


PYTHON PROGRAMMING 2023-2024

Challenges Faced and Overcoming


Throughout the Codsoft Python Programming internship, several. challenges surfaced,
offering invaluable learning experiences that contributed to my growth as a programmer:

1. Complex Problem-solving:

Challenge: Tackling intricate programming problems initially seemed daunting, especially


while implementing algorithms for the Password Generator.

Overcoming: I approached these challenges systematically, breaking them down into


smaller, manageable tasks. Consulting resources, seeking guidance from mentors, and
collaborating with peers helped dissect complex problems into comprehensible segments
for resolution.

2. User Interface Design:

Challenge: Designing user-friendly interfaces for the Simple Calculator and To-Do List
posed challenges in creating layouts conducive to seamless user interaction.

Overcoming: Engaging with UI design tutorials, studying user-centric design principles,


and iterating on interface designs based on feedback enabled me to refine layouts and
enhance usability.

3. Database Integration:

Challenge: Integrating databases within applications, notably in the To-Do List project,
presented complexities in data management.

Overcoming: I studied database integration methodologies, referred to documentation, and


sought guidance from mentors. Incremental implementation and testing helped overcome
hurdles, ensuring efficient data storage and retrieval.

4. Time Management and Project Deadlines:

Challenge: Balancing project commitments, learning modules, and meeting deadlines


posed time management challenges.

Overcoming: I adopted effective time management techniques, such as setting prioritized


task lists, adhering to schedules, and breaking down larger tasks into smaller, achievable
milestones. Regular self-assessment and adjustments ensured project progression without
compromising learning objectives.

5. Adapting to New Concepts:

Department of Electronics and Communication Engineering, BIT PAGE 44


PYTHON PROGRAMMING 2023-2024

Challenge: Adapting to new Python libraries, methodologies, and best practices introduced
during the internship presented a learning curve. Overcoming: I embraced a proactive
learning approach, dedicating time to study new concepts, actively participating in
workshops, and seeking clarification from mentors. Implementing acquired knowledge in
projects reinforced understanding and facilitated adaptation.

6. Collaboration and Communication:

Challenge: Collaborating effectively with diverse team members and articulating ideas
posed communication challenges.

Overcoming: Actively participating in group discussions, practicing active listening, and


fostering an open communication environment facilitated smoother collaboration.
Regularly seeking and providing feedback improved mutual understanding and project
outcomes.

Each challenge was an opportunity for growth. Overcoming these obstacles involved a
combination of resourcefulness, continuous learning, seeking guidance, and collaborative
efforts. These experiences not only strengthened my technical skills but also enriched my
problem-solving abilities and adaptability in the realm of software development.

Department of Electronics and Communication Engineering, BIT PAGE 45


PYTHON PROGRAMMING 2023-2024

Lessons Learned
The internship at CodSoft yielded substantial experiential gains, shaping my journey as a
programmer and offering transformative insights:

1. Practical Programming Application: Hands-on projects like the Simple Calculator,


To-Do List, and Password Generator enabled direct application of theoretical programming
knowledge. These projects served as platforms to implement Python syntax, data
structures, and libraries, bridging the gap between theory and practical application,
fostering a deeper understanding of programming concepts.

2. Iterative Problem-solving: The internship emphasized a problem- solving approach


characterized by continuous refinement. Breaking down complex tasks into smaller,
manageable parts facilitated iterative improvement. Feedback loops and multiple iterations.
allowed for enhancements in functionalities, fostering adaptability and an evolving
problem-solving mindset.

3. Collaboration and Adaptability: Working within diverse teams exposed me to varying


perspectives and methodologies. This experience fostered adaptability, enabling swift
adjustments to new techniques and approaches. Collaborating, exchanging insights, and
collectively addressing challenges underscored the importance of adaptability in team
dynamics.

4. Time Management and Project Execution: Balancing project tasks alongside learning
modules demanded effective time allocation. Prioritizing tasks, setting achievable goals,
and adhering to timelines ensured steady project progress without compromising learning
objectives. This experience honed my ability to manage multiple responsibilities and meet
deadlines efficiently.

5. User-Centric Design and Best Practices: Developing user interfaces highlighted the
importance of designing applications with the end user in mind. Understanding user needs,
implementing intuitive interfaces, and maintaining code readability through clear
documentation and coding standards ensured user-centric design and adherence to best
practices in software development.

Department of Electronics and Communication Engineering, BIT PAGE 46


PYTHON PROGRAMMING 2023-2024

6.1 CONCLUSION

Training can be initiated to address a "performance gap" (learning needed to meet performance
standards for a current task or job), "growth gap" (learning needed to achieve career goals) or
"opportunity gap" (learning needed to qualify for an identified new job or role).

Majority of the employees feel happy and are willing to spend the rest of their carrier with the
organization. Along with this, the employees also feel the organization’s problem as their own and
adhering to the organization is not the consequence of any obligation to them. Further, the
employees feel that training programs establish a clear view of work roles and increase their
performance level. Also the training program provide knowledge sharing demonstrated in the
organization. Also, the training programs are practical and employees were able to apply the
training techniques in their work.

Keeping in view the organizational requirement and goals and objectives of training, the following
have been identified as the key focus areas of training:

Technology, Tooling, Quality, Information Technology.

I am grateful to have been able to get the opportunity to pursue my industrial training at microchip
technology. I had a good learning experience at microchip. I was introduced some state of
technologies that are used to PNR flow.

Department of Electronics and Communication Engineering, BIT PAGE 47


PYTHON PROGRAMMING 2023-2024

6.2 REFERENCES

https://www.codsoft.in/

https://www.geeksforgeeks.org

https://www.studocu.com

https://github.com/abhishek11502/CodSoft/commit/c0d0466604151fd25d99
f0c7d1a05330e0ec1e85

https://github.com/abhishek11502/CodSoft/commit/dfe47a1edb15fae89059
7eea37b8147c99be690f

https://github.com/abhishek11502/CodSoft/commit/16928dd02bced94fd534
96244396c4b25e45f5c1

Department of Electronics and Communication Engineering, BIT PAGE 48


PYTHON PROGRAMMING 2023-2024

CO, PO AND PSO JUSTIFICATION


PO1: Engineering Knowledge
Applied the knowledge Electronics to know the basics of Python programming.

PO2: Problem Analysis


Factors such as different version of Python.

PO4: Conduct investigation of complex problem

Did conduct investigation of problems to improve timing and reduce complexity in programming.

PO5: Modern Tool Usage


Used latest Python version.

PO6: The Engineer and Society


Learnt the use of Python in Machine Learning.

PO8: Ethics
Applied ethical and professional principles at work.

PO9: Individual and Teamwork


Worked individually for the overhaul of projects and also in
the team.

PO10: Communication
Completed the report and provided presentation on the overhaul and
understanding of different engine structures under the instructions of the
internal guide.
PO12: Life-long learning
Learnt to be independent.

Department of Electronics and Communication Engineering, BIT PAGE 49

You might also like