VISION COLLEGE OF MANAGEMENT
VIVA-VOICE SUMMER TRAINING REPORT
(PYTHON)
Affiliated to:
C.S.J.M. University
Session-2024-25
Submitted to: Submitted By:
Vivek Kumar Aryan Shukla
(Assistant Professor) (B.C.A. 3rd yr/5th Sem)
1
Objective
The objective of this summer training report on Python is typically to
summarize the key learnings, skills, and projects I worked on during the
training, along with the practical applications of Python in real-world
scenarios. The report aims to demonstrate my understanding of Python
as a programming language, my ability to apply it to solve problems,
and how the training has helped me grow as a developer.
2
Title Page
Report Title:
Python Programming
Submitted By:
Aryan Shukla
Bachelor of Computer Applications
Institution:
Vision College of Manaegment
affiliated to CSJM University,Kanpur
Submitted To:
Vivek Kumar
(Assistant Professor)
3
4
Acknowledgement
I would like to express my sincere gratitude to all those who have supported and guided me
during my summer internship. This training has been an enriching experience, and I have learned
a great deal about Python programming and its applications.
First and foremost, I would like to thank Shronit Ladhani (founder and CEO , Careerninja), my
supervisor during this internship, for providing me with valuable insights and continuous
guidance throughout the duration of the training. Their expertise, patience, and encouragement
have been pivotal in enhancing my learning experience. I am truly grateful for their constructive
feedback and support.
I would also like to extend my appreciation to the CareerNinja for providing me with this
wonderful opportunity to work and learn in a professional environment. The hands-on
experience and exposure to real-world projects have broadened my understanding of Python
programming and its practical applications.
My heartfelt thanks go to my family and friends, who have been a constant source of support
and motivation throughout this internship. Their encouragement and understanding have kept me
focused and inspired to do my best.
Finally, I would like to acknowledge the contributions of various online resources, books, and
tutorials that have helped me overcome challenges and deepen my understanding of the concepts.
Once again, thank you to everyone who has made this internship an enriching and fulfilling
experience. This report reflects my journey, and I am deeply grateful for the opportunity to apply
my knowledge and learn new skills during this period.
5
6
Table of Contents:
1. Python - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7
2. History of Python - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -8
3. Uses of Python - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 9
Web Development
Game Developement
Data Science
Data Analytics
Block Chain
Software Development
4. Downloading Python - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 12
5. Installing Python On Windows - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 13
6. Data Types - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 14
Description of Data Types
7. Python If-else - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 17
Python Conditions
If Statements
Indentation
Elif
Else
Short-hand if
Short-hand if-else
And
Or
Not
Nested-if
Pass Statements
8. Python Loops
7
While Loop
Break Statement
Continue Statement
Else Statement
For Loop
Looping through a string
Range() Function
Else in for loop
Nested loops
9. Project
Unit Converter
8
Python
Python is a widely used high-level, general-purpose, interpreted, dynamicprogramming
language. Its design philosophy emphasizes code readability, and its syntax allows programmers
to express concepts in fewer lines of code that would not 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.
History of python
The programming language Python was conceived in the late 1980s,and its implementation was
started in December 1989 by Guido van Rossum at CWI in Netherlands as a successor
to ABC 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). (However, Van Rossum stepped down as leader on July 12, 2018).Python was
named after the BBC TV show Monty Python's Flying Circus.
9
“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
Uses of python
Web Development
Game Development
Data Science
Data Analytics
Block Chain
Software Development
10
Web Development - Web development is the process of creating, building, and
maintaining websites and web applications that run on a browser. It involves a combination of
technical and creative tasks, such as coding, programming, and user experience design.
Game Development - Game development is the process of creating video games,
which involves a variety of skills and technical knowledge:
Design: Turning an idea into a design that developers and asset creators can use
Programming: Writing code for the game
Art: Creating 3D models, character models, animations, and visual effects
Audio: Creating sound for the game
User interface: Designing the user interface for the game
11
Data Science -Data science is the study of data to extract meaningful insights for business.
It is a multidisciplinary approach that combines principles and practices from the fields of
mathematics, statistics, artificial intelligence, and computer engineering to analyze large amounts
of data. This analysis helps data scientists to ask and answer questions like what happened, why
it happened, what will happen, and what can be done with the results.
Data Analytics - Data analytics is the process of analyzing, interpreting, and visualizing
large data sets to derive meaningful insights and make informed decisions. It's a field that uses a
variety of techniques, including statistical analysis and machine learning, to analyze past and
current data to predict future trends.
12
Software Development- The process of software development typically involves the
following steps:
Requirements gathering: Gathering requirements from stakeholders
Design: Analyzing requirements and creating a software design
Implementation: Implementing the design in code
Testing: Testing the code to ensure it meets the requirements
Deployment: Deploying the code to the production environment
Block Chain- Block Chain technology is an advanced database mechanism that allows
transparent information sharing within a business network. A block chain database stores data in
blocks that are linked together in a chain. The data is chronologically consistent because you
cannot delete or modify the chain without consensus from the network. The system has built-in
mechanisms that prevent unauthorized transaction entries and create consistency in the shared
view of these transactions.
13
Downloading python
If you don’t already have a copy of Python installed on your computer, you will need to open up
your Internet browser and go to the Python download page
([Link] that you are on the download page, select which of the
software builds you would like to download. For the purposes of this article we will use the most
up to date version available (Python 3.4.1). Following are the steps to downloading python :-
Step 1: Visit the Python Website and Navigate to the Downloads Section
First and foremost step is to open a browser and type Python Download or paste link
([Link]
Step 2: Choose the Python Version
Click on the version you want to download. – Python 3.12.3 (the latest stable
release as of now is Python 3.12.3).
Step 3: Download the Python Installer
Once the download is complete, run the installer program. On Windows , it will
typically be a .exe file , on macOS , it will be a .pkg file , and on Linux , it will be
a .[Link] file.
14
Installing Python on Windows
Here we are providing the installation process of Python 3.11.2 on Windows
Run the Python Installer for how to install Python on the Windows downloads
folder
Make sure to mark Add Python to PATH otherwise you will have to do it
explicitly. It will start installing Python on Windows.
After installation is complete click on Close . Bingo..!! Python is installed. Now
go to Windows and type IDLE.
15
Data Types
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.
Python has many native data types. Here are the important ones:
Lists are ordered sequences of values.
Tuples are ordered, immutable sequences of values.
Sets are unordered bags of values.
Dictionary is used to store data values in key:value pairs.
Description of Data Types
List
Lists are used to store multiple items in a single variable.
Lists are one of 4 built-in data types in Python used to store collections of data, the other 3
are Tuple, Set, and Dictionary, all with different qualities and usage.
Lists are created using square brackets:
Example
Create a List:
thislist = ["apple", "banana", "cherry"]
print(thislist)
16
Tuple
Tuples are used to store multiple items in a single variable.
Tuple is one of 4 built-in data types in Python used to store collections of data, the other 3
are List, Set, and Dictionary, all with different qualities and usage.
A tuple is a collection which is ordered and unchangeable.
Tuples are written with round brackets.
Example
Create a Tuple:
thistuple = ("apple", "banana", "cherry")
print(thistuple)
Set
Sets are used to store multiple items in a single variable.
Set is one of 4 built-in data types in Python used to store collections of data, the other 3
are List, Tuple, and Dictionary, all with different qualities and usage.
A set is a collection which is unordered, unchangeable, and unindexed.
Note : Set items are unchangeable, but you can remove items and add new items.
Sets are written with curly brackets.
Example
Create a Set:
thisset = {"apple", "banana", "cherry"}
print(thisset)
17
Dictionary
Dictionaries are used to store data values in key:value pairs.
A dictionary is a collection which is ordered, changeable and do not allow duplicates.
As of Python version 3.7, dictionaries are ordered. In Python 3.6 and earlier, dictionaries
are unordered.
Dictionaries are written with curly brackets, and have keys and values:
Example
Create and print a dictionary:
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
print(thisdict)
Output
{'brand': 'Ford', 'model': 'Mustang', 'year': 1964}
18
Python If ... Else
Python Conditions
Python supports the usual logical conditions from mathematics:
Equals: a == b
Not Equals: a != b
Less than: a < b
Less than or equal to: a <= b
Greater than: a > b
Greater than or equal to: a >= b
These conditions can be used in several ways, most commonly in "if statements" and loops.
If statements
An "if statement" is written by using the if keyword.
Example
If statement:
a = 33
b = 200
if b > a:
print("b is greater than a")
Output
b is greater than a
19
Indentation
Python relies on indentation (whitespace at the beginning of a line) to define scope in the code.
Other programming languages often use curly-brackets for this purpose.
Example
If statement, without indentation (will raise an error):
a = 33
b = 200
if b > a:
print("b is greater than a") # you will get an error
Output
File "demo_if_error.py", line 4
print("b is greater than a")
^
IndentationError: expected an indented block
Elif
The elif keyword is Python's way of saying "if the previous conditions were not true, then try this
condition".
Example
a = 33
b = 33
if b > a:
print("b is greater than a")
elif a == b:
print("a and b are equal")
Output
a and b are equal
20
Else
The else keyword catches anything which isn't caught by the preceding conditions.
Example
a = 200
b = 33
if b > a:
print("b is greater than a")
elif a == b:
print("a and b are equal")
else:
print("a is greater than b")
Output
a is greater than b
In this example a is greater than b, so the first condition is not true, also the elif condition is not
true, so we go to the else condition and print to screen that "a is greater than b".
You can also have an else without the elif :
Example
a = 200
b = 33
if b > a:
print("b is greater than a")
else:
print("b is not greater than a")
Output
b is not greater than a
21
Short Hand If
If you have only one statement to execute, you can put it on the same line as the if statement.
Example
One line if statement:
if a > b: print("a is greater than b")
Output
"a is greater than b"
Short Hand If ... Else
If you have only one statement to execute, one for if, and one for else, you can put it all on the
same line:
Example
One line if else statement:
a = 2
b = 330
print("A") if a > b else print("B")
Output
B
22
# This technique is known as Ternary Operators, or Conditional Expressions.
You can also have multiple else statements on the same line:
Example
One line if else statement, with 3 conditions:
a = 330
b = 330
print("A") if a > b else print("=") if a == b else print("B")
Output
=
And
The and keyword is a logical operator, and is used to combine conditional statements:
Example
Test if a is greater than b, AND if c is greater than a:
a = 200
b = 33
c = 500
if a > b and c > a:
print("Both conditions are True")
Output
Both conditions are True
Or
23
The or keyword is a logical operator, and is used to combine conditional statements:
Example
Test if a is greater than b, OR if a is greater than c:
a = 200
b = 33
c = 500
if a > b or a > c:
print("At least one of the conditions is True")
Output
At least one of the conditions is True
Not
The not keyword is a logical operator, and is used to reverse the result of the conditional
statement:
Example
Test if a is NOT greater than b:
a = 33
b = 200
if not a > b:
print("a is NOT greater than b")
Output
a is NOT greater than b
Nested If
24
You can have if statements inside if statements, this is called nested if statements.
Example
x = 41
if x > 10:
print("Above ten,")
if x > 20:
print("and also above 20!")
else:
print("but not above 20.")
Output
Above ten,
and also above 20!
The pass Statement
if statements cannot be empty, but if you for some reason have an if statement with no content,
put in the pass statement to avoid getting an error.
Example
a = 33
b = 200
if b > a:
pass
# having an empty if statement like this, would raise
an error without the pass statement
25
Python Loops
Python has two primitive loop commands:
while loops
for loops
The while Loop
With the while loop we can execute a set of statements as long as a condition is true.
Example
Print i as long as i is less than 6:
i = 1
while i < 6:
print(i)
i += 1
Output
1
2
3
4
5
Note: remember to increment i, or else the loop will continue forever.
The while loop requires relevant variables to be ready, in this example we need to define an
indexing variable, i, which we set to 1.
26
The break Statement
With the break statement we can stop the loop even if the while condition is true:
Example
Exit the loop when i is 3:
i = 1
while i < 6:
print(i)
if i == 3:
break
i += 1
Output
1
2
3
The continue Statement
With the continue statement we can stop the current iteration, and continue with the next:
Example
Continue to the next iteration if i is 3:
i = 0
while i < 6:
i += 1
if i == 3:
continue
print(i)
27
Output
1
2
4
5
6
# Note that number 3 is missing in the result
The else Statement
With the else statement we can run a block of code once when the condition no longer is true:
Example
Print a message once the condition is false:
i = 1
while i < 6:
print(i)
i += 1
else:
print("i is no longer less than 6")
Output
1
2
3
4
5
i is no longer less than 6
28
Python For Loops
A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or
a string).
This is less like the for keyword in other programming languages, and works more like an
iterator method as found in other object-orientated programming languages.
With the for loop we can execute a set of statements, once for each item in a list, tuple, set etc.
Example
Print each fruit in a fruit list:
fruits = ["apple", "banana", "cherry"]
for x in fruits:
print(x)
Output
apple
banana
cherry
The for loop does not require an indexing variable to set beforehand.
Looping Through a String
Even strings are iterable objects, they contain a sequence of characters:
Example
Loop through the letters in the word "banana":
for x in "banana":
print(x)
29
Output
b
a
n
a
n
a
# With the break statement we can stop the loop before it has looped through all the items:
Example
Exit the loop when x is "banana":
fruits = ["apple", "banana", "cherry"]
for x in fruits:
print(x)
if x == "banana":
break
Output
apple
banana
Example
Exit the loop when x is "banana", but this time the break comes before the print:
fruits = ["apple", "banana", "cherry"]
for x in fruits:
if x == "banana":
break
print(x)
Output apple
30
The continue Statement
With the continue statement we can stop the current iteration of the loop, and continue with the
next:
Example
Do not print banana:
fruits = ["apple", "banana", "cherry"]
for x in fruits:
if x == "banana":
continue
print(x)
Output
apple
cherry
The range() Function
To loop through a set of code a specified number of times, we can use the range() function,
The range() function returns a sequence of numbers, starting from 0 by default, and increments
by 1 (by default), and ends at a specified number.
Example
Using the range() function:
for x in range(6):
print(x)
31
Output
0
1
2
3
4
5
Note that range(6) is not the values of 0 to 6, but the values 0 to 5.
# The range() function defaults to 0 as a starting value, however it is possible to specify the
starting value by adding a parameter: range(2, 6), which means values from 2 to 6 (but not
including 6):
Example
Using the start parameter:
for x in range(2, 6):
print(x)
Output
2
3
4
5
32
# The range() function defaults to increment the sequence by 1, however it is possible to specify
the increment value by adding a third parameter: range(2, 30, 3):
Example
Increment the sequence with 3 (default is 1):
for x in range(2, 30, 3):
print(x)
Output
2
5
8
11
14
17
20
23
26
29
Else in For Loop
The else keyword in a for loop specifies a block of code to be executed when the loop is
finished:
Example
Print all numbers from 0 to 5, and print a message when the loop has ended:
for x in range(6):
print(x)
else:
print("Finally finished!")
Note: The else block will NOT be executed if the loop is stopped by a break statement.
Output
33
0
1
2
3
4
5
Finally finished!
Example
Break the loop when x is 3, and see what happens with the else block:
for x in range(6):
if x == 3: break
print(x)
else:
print("Finally finished!")
Nested Loops
A nested loop is a loop inside a loop.
The "inner loop" will be executed one time for each iteration of the "outer loop":
Example
Print each adjective for every fruit:
adj = ["red", "big", "tasty"]
fruits = ["apple", "banana", "cherry"]
for x in adj:
for y in fruits:
print(x, y)
Output
red apple
red banana
red cherry
34
big apple
big banana
big cherry
tasty apple
tasty banana
tasty cherry
The pass Statement
for loops cannot be empty, but if you for some reason have a for loop with no content, put in
the pass statement to avoid getting an error.
Example
for x in [0, 1, 2]:
pass
# having an empty for loop like this, would raise an error without the pass statement
35
Project
# Unit Converter
def convert_distance(value, from_unit, to_unit):
# Distance conversion logic (for meters, kilometers, miles)
if from_unit == 'meters':
if to_unit == 'kilometers':
return value / 1000
elif to_unit == 'miles':
return value * 0.000621371
elif from_unit == 'kilometers':
if to_unit == 'meters':
return value * 1000
elif to_unit == 'miles':
return value * 0.621371
elif from_unit == 'miles':
if to_unit == 'meters':
return value / 0.000621371
elif to_unit == 'kilometers':W3schools Pathfinder
return value / 0.621371
return value
def convert_temperature(value, from_unit, to_unit):
# Temperature conversion logic (Celsius, Fahrenheit, Kelvin)
if from_unit == 'Celsius':
if to_unit == 'Fahrenheit':
return value * 9/5 + 32
elif to_unit == 'Kelvin':
return value + 273.15
elif from_unit == 'Fahrenheit':
if to_unit == 'Celsius':
return (value - 32) * 5/9
elif to_unit == 'Kelvin':
return (value - 32) * 5/9 + 273.15
elif from_unit == 'Kelvin':
if to_unit == 'Celsius':
return value - 273.15
elif to_unit == 'Fahrenheit':
return (value - 273.15) * 9/5 + 32
return value
def convert_weight(value, from_unit, to_unit):
# Weight conversion logic (kilograms, grams, pounds)
if from_unit == 'kilograms':
if to_unit == 'grams':
return value * 1000
elif to_unit == 'pounds':
return value * 2.20462
elif from_unit == 'grams':
if to_unit == 'kilograms':
return value / 1000
elif to_unit == 'pounds':
return value * 0.00220462
36
elif from_unit == 'pounds':
if to_unit == 'kilograms':
return value / 2.20462
elif to_unit == 'grams':
return value * 453.592
return value
def main():
print("Unit Converter")
print("1. Distance (meters, kilometers, miles)")
print("2. Temperature (Celsius, Fahrenheit, Kelvin)")
print("3. Weight (kilograms, grams, pounds)")
category = input("Choose category (1/2/3): ")
if category == '1':
value = float(input("Enter value: "))
from_unit = input("From unit (meters, kilometers, miles): ").lower()
to_unit = input("To unit (meters, kilometers, miles): ").lower()
result = convert_distance(value, from_unit, to_unit)
print(f"{value} {from_unit} is equal to {result} {to_unit}.")
elif category == '2':
value = float(input("Enter value: "))
from_unit = input("From unit (Celsius, Fahrenheit, Kelvin):
").capitalize()
to_unit = input("To unit (Celsius, Fahrenheit, Kelvin):
").capitalize()
result = convert_temperature(value, from_unit, to_unit)
print(f"{value} {from_unit} is equal to {result} {to_unit}.")
elif category == '3':
value = float(input("Enter value: "))
from_unit = input("From unit (kilograms, grams, pounds): ").lower()
to_unit = input("To unit (kilograms, grams, pounds): ").lower()
result = convert_weight(value, from_unit, to_unit)
print(f"{value} {from_unit} is equal to {result} {to_unit}.")
else:
print("Invalid category. Please choose 1, 2, or 3.")
if __name__ == "__main__":
main()
37
Output:
1. Distance (meters, kilometers, miles)
2. Temperature (Celsius, Fahrenheit, Kelvin)
3. Weight (kilograms, grams, pounds)
Choose category (1/2/3): 3
Enter value: 3000
From unit (kilograms, grams, pounds): grams
To unit (kilograms, grams, pounds): kilograms
3000.0 grams is equal to 3.0 kilograms.
>>>
38
39
40
41