Sie sind auf Seite 1von 29

Summer Training Report

On

PYTHON PROGRAMMING
Submitted in partial fulfillment of the
requirement for the award of the degree
of

Bachelor of Computer Application

Submitted by

Kushagra Srivastava
201710101130096

DEPARTMENT OF COMPUTER APPLICATIONS


SHRI RAMSWAROOP MEMORIAL UNIVERSITY, LUCKNOW DEVA ROAD

October – 2019
DECLARATION

I hereby declare that this submission is my own work and that, to the best of my
knowledge and belief, it contains no material previously published or written by
another person nor material which to a substantial extent has been accepted for the
award of any other degree or diploma of the university or other institute of higher
learning, except where due acknowledgment has been made in the text.

Name Kushagra Srivastava


Roll No. 201710101130096
Date

i|Page
ACKNOWLEDGEMENT

It gives us a great sense of pleasure to present the report of the B.C.A. Project
undertaken during B.C.A. Final Year. We owe special debt of gratitude to Ms. Anshita
Raj, Department of Computer Application, Shri Ramswaroop Memorial University for
his constant support and guidance throughout the course of our work.

We also take the opportunity to acknowledge the contribution of Professor Dr. B.K.
Gupta, Head, Department of Computer Application, Shri Ramswaroop Memorial
University, Lucknow for his full support and assistance during the development of the
project.

We also do not like to miss the opportunity to acknowledge the contribution of all
faculty members of the department for their kind assistance and cooperation during the
development of our project. Last but not the least, we acknowledge our friends for their
contribution in the completion of the project.

Name : Kushagra Srivatava


Roll No.: 201710101130096
Date :

ii | P a g e
ABSTRACT

Python is a high-level, interpreted, interactive and object-oriented scripting language.


Python is designed to be highly readable. It uses English keywords frequently where as
other languages use punctuation, and it has fewer syntactical constructions than other
languages.
 Python is Interpreted − Python is processed at runtime by the interpreter. You do not need
to compile your program before executing it. This is similar to PERL and PHP.
 Python is Interactive − You can actually sit at a Python prompt and interact with the
interpreter directly to write your programs.
 Python is Object-Oriented − Python supports Object-Oriented style or technique of
programming that encapsulates code within objects.
 Python is a Beginner's Language − Python is a great language for the beginner-level
programmers and supports the development of a wide range of applications from simple
text processing to WWW browsers to games.

Apart from the above-mentioned features, Python has a big list of good features, few
are listed below −
 It supports functional and structured programming methods as well as OOP.
 It can be used as a scripting language or can be compiled to byte-code for building large
applications.
 It provides very high-level dynamic data types and supports dynamic type checking.
 It supports automatic garbage collection.
 It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.

iii | P a g e
ABOUT COMPANY

CETPA INFOTECH PVT LTD is the leader in the “specialized training” brands of
India certified by ISO 9001:2015 for its best quality. CETPA INFOTECH is the
largest training service provider in various engineering domains for all engineering
students as well as for the working professionals. It has an extensive experience
of nurturing over 200000+ students in the past few years.

CETPA has been awarded as the “Best IT and Embedded Training Company” for 5
consecutive years for delivering high quality training and workshops at more than
500 colleges across India. CETPA is a trustworthy brand in Education and Training
industry with its presence across several cities such as Noida, Roorkee, Lucknow,
Dehradun and . The company was started 12 years back and it is continuously
expanding having its overseas branches in Germany and Ukraine.

CETPA has specialization in 3 important domains namely: TRAINING,


DEVELOPMENT and CONSULTANCY. The company provides specialized training in
50+ leading technologies like .NET, Java, PHP, Ethical Hacking, ANDROID, CCNA,
AUTOCAD, VHDL, MATLAB, EMBEDDED SYSTEM, HVAC and many more. CETPA
has a very committed team consisting of technical trainers who are continuously
guiding, mentoring, admonish and coaching the students by providing them with
exclusive personalized attention, which helps them to develop solid industry
oriented knowledge.

iv | P a g e
v|Page
TABLE OF CONTENTS
Page No.
Declaration i
Acknowledgement ii
Abstract iii
About Company/industry/institute iv

Chapter 1: Introduction
1.1 Features of Python ………………………………………………………………… 1
1.2 Introduction to Data Exploration using Python……………………………………. 2
1.2.1 How to load data file(s)?............................................................................. 2
1.2.2 How to convert a variable to different data type?....................................... 3
1.2.3 How to transpose a table?.......................................................................... 5
1.2.4 How to sort Data?...................................................................................... 6
1.2.5 How to create plots (Histogram, Scatter, Box Plot)?.................................. 7

Chapter 2: Project Work 12


2.1 Introduction………………………………………………………………………….. 12
2.1.1 Front – End……………………………………………………………….. 12
2.1.2 Back – End………………………………………………………………… 13
2.2 Why Django…?.......................................................................................................... 13
2.3 How Django interacts with the User………………………………………………. 14
2.4 Creation of Project…………………………………………………………………. 14
2.5 Starting Project ……………………………………………………………………. 16
2.6 URL Dispatcher ……………………………………………………………………. 16
2.7 Database……………………………………………………………………………... 17
2.8 Modules of Digikart online – store for computers smartphones and peripherals …,,, 18

Chapter 3: Conclution and Future Scope 21

References 22

vi | P a g e
Introduction
Python is a widely used general-purpose, high level programming language. It was initially
designed by Guido van Rossum in 1991 and developed by Python Software Foundation. It was
mainly developed for emphasis on code readability, and its syntax allows programmers to
express concepts in fewer lines of code.
Python is a programming language that lets you work quickly and integrate systems more
efficiently.
There are two major Python versions- Python 2 and Python 3. Both are quite different.

2.8 Features of Python


Python provides lots of features that are listed below.

2.8.2) Easy to Learn and Use


Python is easy to learn and use. It is developer-friendly and high level
programming language.

1.1.2) Expressive Language

Python language is more expressive means that it is more understandable


and readable.

1.1.3) Interpreted Language

Python is an interpreted language i.e. interpreter executes the code line by


line at a time. This makes debugging easy and thus suitable for beginners.

1.1.4) Cross-platform Language

Python can run equally on different platforms such as Windows, Linux, Unix
and Macintosh etc. So, we can say that Python is a portable language.

1.1.5) Free and Open Source

Python language is freely available at offical web address.The source-code is


also available. Therefore it is open source.

1.1.6) Object-Oriented Language

Python supports object oriented language and concepts of classes and objects
come into existence.

1|Page
1.1.7) Extensible

It implies that other languages such as C/C++ can be used to compile the
code and thus it can be used further in our python code.

1.1.8) Large Standard Library

Python has a large and broad library and prvides rich set of module and
functions for rapid application development.

1.1.9) GUI Programming Support

Graphical user interfaces can be developed using Python.

1.1.10) Integrated

It can be easily integrated with languages like C, C++, JAVA etc.

1.2) Introduction to Data Exploration using Python


Exploring data sets and developing deep understanding about the data is one of the most important
skill every data scientist should possess. People estimate that time spent on these activities can go as
high as 80% of the project time in some cases.

Python has been gaining a lot of ground as preferred tool for data scientists lately, and for the right
reasons. Ease of learning, powerful libraries with integration of C/C++, production readiness and
integration with web stack are some of the main reasons for this move lately.

In this guide, I will use NumPy, Matplotlib, Seaborn and Pandas to perform data exploration. These
are powerful libraries to perform data exploration in Python. The idea is to create a ready reference
for some of the regular operations required frequently. I am using iPython Notebook to perform data
exploration, and would recommend the same for its natural fit for exploratory analysis.

1.2.1) How to load data file(s)?

Input data sets can be in various formats (.XLS, .TXT, .CSV, JSON ).
In Python, it is easy to load data from any source, due to its simple syntax
and availability of predefined libraries. Here I will make use of Pandas. It
features a number of functions for reading tabular data as a DataFrame
object. Below are the common functions that can be used to read data.

2|Page
Loading data from CSV file(s):

Code

import pandas as pd

#Import Library Pandas

df = pd.read_csv(“E:/train.csv”) #I am working in Windows environment

#Reading the dataset in a dataframe using Pandas

print df.head(3) #Print first three observations

Output

1.2.2) How to convert a variable to different data type?

3|Page
Converting a variable data type to other is important and common procedure
we perform after loading data. Let’s look at some of the commands to perform
these conversions:

 Convert numeric variables to string variables and vice versa

srting_outcome = str(numeric_input) #Converts numeric_input to string_outcome

integer_outcome = int(string_input) #Converts string_input to integer_outcome

float_outcome = float(string_input) #Converts string_input to integer_outcome

The later operations are especially useful when you input value from user using raw_input().
By default, the values are read at string.

 Convert character date to Date:

There are multiple ways to do this. The simplest would be to use datetime library and
strptime function. Here is the code:

from datetime import datetime

char_date = ‘Apr 1 2015 1:20 PM’ #creating example character date

date_obj = datetime.strptime(char_date, ‘%b %d %Y %I:%M%p’)

print date_obj

4|Page
1.2.3) How to transpose a table?

Here, I want to transpose Table A into Table B on variable Product. This task
can be accomplished by using dataframe.pivot.

Code

#Transposing dataframe by a variable

df=pd.read_excel(“E:/transpose.xlsx”, “Sheet1”) # Load Data sheet of excel file EMP

print df

result= df.pivot(index= ‘ID’, columns=’Product’, values=’Sales’)

result

Output

5|Page
1.2.4) How to sort Data?

Sorting of data can be done using dataframe.sort(). It can be based on multiple


variables and ascending or descending both order.

Code

#Sorting Dataframe

df=pd.read_excel(“E:/transpose.xlsx”, “Sheet1”) #Add by variable name(s) to sort

print df.sort([‘Product’,’Sales’], ascending=[True, False])

6|Page
Above, we have a table with variables ID, Product and Sales. Now, we want to sort it by
Product and Sales (in descending order)

1.2.5) How to create plots (Histogram, Scatter, Box Plot)?

Data visualization always helps to understand the data easily. Python has library
like matplotlib and seaborn to create multiple graphs effectively. Let’s look at the some of
the visualization to understand below behavior of variable(s) .

 The distribution of age


 Relation between age and sales; and
 If sales are normally distributed or not?

Histogram:

Code

7|Page
#Plot Histogram

import matplotlib.pyplot as plt

import pandas as pd

df=pd.read_excel(“E:/First.xlsx”, “Sheet1”)

#Plots in matplotlib reside within a figure object, use plt.figure to create new figu

re

fig=plt.figure()

#Create one or more subplots using add_subplot, because you can’t create blank figure

ax = fig.add_subplot(1,1,1)

#Variable

ax.hist(df[‘Age’],bins = 5)

#Labels and Tit

plt.title(‘Age distribution’)

plt.xlabel(‘Age’)

plt.ylabel(‘#Employee’)

8|Page
plt.show()

Output

Scatter plot:

Code

#Plots in matplotlib reside within a figure object, use plt.figure to create new figu

re fig=plt.figure()

#Create one or more subplots using add_subplot, because you can’t create blank figure

ax = fig.add_subplot(1,1,1)

#Variable

ax.scatter(df[‘Age’],df[‘Sales’])

9|Page
#Labels and Tit

plt.title(‘Sales and Age distribution’)

plt.xlabel(‘Age’)

plt.ylabel(‘Sales’)

plt.show()

Output

Box-plot:

Code

10 | P a g e
import seaborn as sns

sns.boxplot(df[‘Age’])

sns.despine()

Output

11 | P a g e
Project Work

2.1 Introduction

My Project is a basic E-Commerce website named Digikart Online – Shop for


Computers , Smartphones and Peripherals . It provides the user to buy Computers ,
Smartphones and Peripherals online . I have used the following to make my website :-

2.1.1) Front – End

 HTML (Hyper text markup language)


Hypertext Markup Language (HTML) is the standard markup language for
documents designed to be displayed in a web browser. It can be assisted by
technologies such as Cascading Style Sheets (CSS) and scripting languages such
as JavaScript.

 CSS (Cascading Style Sheets)

Cascading Style Sheets (CSS) is a stylesheet language used to describe the


presentation of a document written in HTML or XML (including XML dialects
such as SVG, MathML or XHTML). CSS describes how elements should be
rendered on screen, on paper, in speech, or on other media.

 JAVASCRIPT (JS)

JavaScript (JS) is a lightweight, interpreted, or just-in-time


compiled programming language with first-class functions. While it is most well-
known as the scripting language for Web pages.
JavaScript is a prototype-based, multi-paradigm, dynamic language, supporting
object-oriented, imperative, and declarative (e.g. functional programming) styles

12 | P a g e
2.1.2) Back – End

 MySQL

MySQL is a relational database management system


(RDBMS). MySQL is fast, reliable, and flexible and easy to
use. MySQL supports standard SQL (Structured Query
Language). MySQL is presently developed, distributed, and supported by
Oracle Corporation.

 Django

Django is a free and open source web application framework


written in Python. A framework is nothing more than a
collection of modules that make development easier. They are
grouped together, and allow you to create applications or
websites from an existing source, instead of from scratch.

2.2) Why Django…?

13 | P a g e
2.3) How Django interacts with the user

2.4) Creation of Project

Open Command Prompt and type the following:-

 14jango-admin startproject <<project name>>


 Change directory to <<project name>>
 Run the application

o Python manage.py runserver

14 | P a g e
Open browser and type 127.0.0.1:8000

Structure

• The outer mysite/ root directory is just a container for your project. Its name doesn’t
matter to Django; you can rename it to anything you like.

• manage.py: A command-line utility that lets you interact with this Django project in
various ways. You can read all the details about manage.py in 15jango-admin and
manage.py.

• The inner mysite/ directory is the actual Python package for your project. Its name is the
Python package name you’ll need to use to import anything inside it (e.g. mysite.urls).

15 | P a g e
• mysite/__init__.py: An empty file that tells Python that this directory should be
considered a Python package. If you’re a Python beginner, read more about packages in
the official Python docs.

• mysite/settings.py: Settings/configuration for this Django project. Django settings


will tell you all about how settings work.

• mysite/urls.py: The URL declarations for this Django project; a “table of contents” of
your Django-powered site. You can read more about URLs in URL dispatcher.

• mysite/wsgi.py: An entry-point for WSGI-compatible web servers to serve your project.


See How to deploy with WSGI for more details.

2.5) Starting Project

 Django-admin startproject <<project_name>>

 You will get following structure :-

2.6) URL Dispatcher

16 | P a g e
1. Django determines the root URLconf module to use. Ordinarily, this is the value of the
ROOT_URLCONF setting

2. Django loads that Python module and looks for the variable urlpatterns

3. Django runs through each URL pattern, in order, and stops at the first one that matches
the requested URL.

4. Once one of the URL patterns matches, Django imports and calls the given view, which
is a simple Python function (or a class-based view). The view gets passed the following
arguments:

A. An instance of HttpRequest.

B. If the matched URL pattern returned no named groups, then the matches from the
regular expression are provided as positional arguments.

C. The keyword arguments are made up of any named parts matched by the path
expression, overridden by any arguments specified in the optional kwargs
argument to 17jango.urls.path() or 17jango.urls.re_path().

5. If no URL pattern matches, or if an exception is raised during any point in this process,
Django invokes an appropriate error-handling view.

2.7) Database

Create database in mysql=<<Database_name>>

Pip install pymysql

Goto setings.py and change database to mysql

‘default’:

‘ENGINE’: ‘django.db.backends.mysql',
'NAME': 'onlineshop',
'USER': 'root',

17 | P a g e
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '3306'
}

Structure of Database

2.8) MODULES OF DIGIKART ONLINE – STORE FOR COMPUTERS


SMARTPHONES AND PERIPHERALS

1. Administrator or Superuser Module

 It has the rights to update website items and also it can add new products ,
users and all the things which administrator does.

18 | P a g e
2. Registration Page

• It allows user to register himself by asking his/her personal information on the


website.

• After registration he/she can make purchases on the website.

19 | P a g e
3. Login Page

It allows the user to login into the website. If user is not registered, there is a
redirection for registration page on it.

4. Cart (For Viewing Products to be Purchased)

• It allows the user to checkout the products that he added to his cart so that
afterwards a detailed bill of the products would be generated.

20 | P a g e
CONCLUSION AND FUTURE SCOPE

Digital Marketing scope in future of marketing will not only thrive in the most result -oriented
fashion but also let businesses survive. Following latest updates, including new techniques of
Google and combining future trends in digital marketing will let your inbound marketing
acquire great benefits for you in 2018.
It will be worthwhile for you to climb on to the digital bandwagon when the time is right as
Digital Marketing sure remains as the most effective way of marketing in the future too, either
business-wise or career-wise.

In today’s world of internet, Digital Marketing is the only one and most guaranteed way of
marketing, which is popularly being the most preferred space for marketing communications
and related interactions.
The future of marketing is way beyond the traditional marketing and now, marketing is
majorly based on the Digital Sphere. The scope of Digital Marketing provides some of the
most powerful techniques of marketing where traditional modes of marketing fail.
The great panjandrum on Digital Marketing over industrialists is to empower them and to
optimize their start-ups in the quickest possible and most cost-effective fashion. Future of
digital marketing is going to be more encompassing in 2018. Undoubtedly, it is an undeniable
fact that there is a great scope in digital marketing.
The things that are considered for Digital marketing are like –

 Search engine results – page rankings


 Search engine platforms – Advertising

21 | P a g e
 Conversion through SMO & SEO campaigns
 Optimization of internet marketing & associated ROI
 Marketing on Digital World & Banner ads on other websites

REFRENCES

1. https://www.geeksforgeeks.org/python-language-introduction/
2. https://www.analyticsvidhya.com/blog/2015/04/comprehensive-guide-data-exploration-sas-
using-python-numpy-scipy-matplotlib-pandas/
3. NIIT E–Books of Django
4. Slides of Django Project by NIIT
5. https://www.excelr.com/the-future-scope-of-digital-marketing

22 | P a g e

Das könnte Ihnen auch gefallen