0% found this document useful (0 votes)
4 views

Training Report on Python Programming

The document is a report by Vishal Gupta on a project to create a password generator using Python, focusing on the use of libraries such as Tkinter, random, and string. It outlines the fundamentals of Python, scripting languages, and object-oriented programming, as well as the steps involved in building the password generator application. The project aims to enhance password security by generating strong, customizable passwords for users.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Training Report on Python Programming

The document is a report by Vishal Gupta on a project to create a password generator using Python, focusing on the use of libraries such as Tkinter, random, and string. It outlines the fundamentals of Python, scripting languages, and object-oriented programming, as well as the steps involved in building the password generator application. The project aims to enhance password security by generating strong, customizable passwords for users.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Report on Password Generator Python

Project
Bachelor of Technology
In
Information Technology
By
Vishal Gupta (Roll no. 2007350130064)

Department of Information Technology

Rajkiya Engineering College Bijnor.

(Affiliated to Dr. A.P.J. Abdul Kalam Technical University, Lucknow).


The report submitted by Vishal Gupta (Roll No.
2007350130064 is approved for the fulfillment of
the requirement for the award of the degree of
Bachelor of Technology in Information Technology.

(Dr. Ishan Bhardwaj)

Place: Rajkiya Engineering College Bijnor.


Date:
INTRODUCTION

1.1 PYTHON

Python is a widely used high-level, general-purpose, interpreted, dynamic


programming language. Its design philosophy emphasizes code readability, and its
syntax allows programmers to express concepts in fewer lines of code than would
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.

1.2 SCRIPTINNG LANGAUGE

A scripting or script language is a programming language that supports scripts,


programs written for a special run-time environment that automate the execution
of tasks that could alternatively be executed one-by-one by a human operator.
Scripting languages are often interpreted (rather than compiled). Primitives are
usually the elementary tasks or API calls, and the language allows them to be
combined into more complex programs. Environments that can be automated
through scripting include software applications, web pages within a web browser,
the shells of operating systems (OS), embedded systems, as well as numerous
games. A scripting language can be viewed as a domain-specific language for a
particular environment; in the case of scripting an application, this is also known
as an extension language. Scripting languages are also sometimes referred to as
very high-level programming languages, as they operate at a high level of
abstraction, or as control languages.

1.3 Object Oriented Programming Language

Object-oriented programming (OOP) is a programming paradigm based on the


concept of "objects", which may contain data, in the form of fields, often known as
attributes; and code, in the form of procedures, often known as methods. A
distinguishing feature of objects is that an object's procedures can access and
often modify the data fields of the object with which they are associated (objects
have a notion of "this" or "self"). In OO programming, computer programs are
designed by making them out of objects that interact with one another. There is
significant diversity in object oriented programming, but most popular languages
are class-based, meaning that objects are instances of classes, which typically also
determines their type.

1.4 History

Python was conceived in the late 1980s, and its implementation was started in
December 1989 by Guido van Rossum at CWI in the Netherlands as a successor to
the ABC language (itself inspired by SETL) 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).
“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

1.5 BEHIND THE SCENE OF PYTHON

About the origin of Python, Van Rossum wrote in 1996:

Over six years ago, in December 1989, I was looking for a "hobby" programming
project that would keep me occupied during the week around Christmas. My office
... would be closed, but I had a home Computer, and not much else on my hands. I
decided to write an interpreter for the new scripting language I had been thinking
about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose
Python as a working title for the project, being in a slightly irreverent mood (and a
big fan of Monty Python's Flying Circus).

1.6 SCOPE OF PYTHON

 Science

- Bioinformatics

 System Administration

-Unix

-Web logic

-Web sphere

 Web Application Development

-CGI

 Testing scripts

1.7 What Can We do With Python?


1. System programming

2. Graphical User Interface Programming

3. Internet Scripting

4. Component Integration

5. Database Programming

6. Gaming, Images, XML , Robot and more……

1.8 Who Uses Python Today


Python is being applied in real revenue-generating products by real.

Companies like Google makes extensive use of Python in its web search system,
employs. Python’s creator. Intel, Cisco, Hewlett-Packard, Seagate, Qualcomm, and
IBM use Python. For hardware testing. ESRI uses Python as an end-user
customization tool for its popular GI mapping products. The YouTube video
sharing service is largely written in Python.

1.9 Why Do People Use Python?

The following primary factors cited by Python users seem to be these:

a) Python is object-oriented.

b) Structure supports such concepts as polymorphism, operation overloading, and


multiple inheritance.

c) Indentation is one of the greatest future in Python. It's free (open source).

d) Source code is easily accessible .


We know that passwords are a real security threat. To keep your account safe
and prevent your password from being hacked you have to make your
password hard enough that nobody can guess.

Password Generator
It is a tool that generates passwords based on the given guidelines that you set
to create an unpredictable strong password for your accounts.

The Password generator tool creates a random and customized password for
users that helps them to create a strong password which provides greater
security.

The objective of this project is to create a password generator using python.


The password generator project will be build using python modules like
Tkinter, random, string,

Project Prerequisites
To build this project we will use the basic concept of python and libraries –
Tkinter, random, string.

• Tkinter is a standard GUI library and is one of the easiest ways to build
a GUI application.
• The random module can generate random numbers
• string module contains a number of functions to process the standard
python string.

To install the libraries we can use pip installer from the command line:

pip install tkinter


pip install pyperclip
pip install random
pip install strings

:
Project File Structure
Let’s check the step to build a Password Generator using Python

1 Import modules
2 Initialized Window
3 Select Password Length
4 Define Functions

Steps to create random password generator


1. Import Libraries
The first step is to import libraries
from tkinter import *

import random, string

import pyperclip

2. Initialize Window
root = Tk()

root.geometry("400x400")

root.resizable(0,0)

root.title("DataFlair - PASSWORD GENERATOR")

1 Tk() initialized tkinter which means window created.


2 geometry() set the width and height of the window
3 resizable(0,0) set the fixed size of the window
4 title() set the title of the

Label(root, text = 'PASSWORD GENERATOR' , font ='arial 15 bold').pack()

Label(root, text ='DataFlair', font ='arial 15 bold').pack(side = BOTTOM)

Label() widget use to display one or more than one line of text that users
can’t able to modify.

1 root is the name which we refer to our window


2 text which we display on the label
3 font in which the text is written
4 pack organized widget in block

3. Select Password Length


pass_label = Label(root, text = 'PASSWORD LENGTH', font = 'arial 10 bold').pack()
pass_len = IntVar()
length = Spinbox(root, from_ = 8, to_ = 32 , textvariable = pass_len , width = 15).pack()

pass_len is an integer type variable that stores the length of a password.

To select the password length we use Spinbox() widget.

Spinbox() widget is used to select from a fixed number of values. Here the
value from 8 to 32.

4. Function to Generate Password


pass_str = StringVar()
def Generator():
password = ''

for x in range (0,4):


password = random.choice(string.ascii_uppercase) + random.choice(string.ascii_lowercase)
+ random.choice(string.digits) + random.choice(string.punctuation)
for y in range(pass_len.get()- 4):
password = password + random.choice(string.ascii_uppercase + string.ascii_lowercase +
string.digits + string.punctuation)
pass_str.set(password)

pass_str is a string type variable that stores the generated password

password = “” is the empty string

First loop will generate a string of length 4 which is a combination of an


uppercase letter, a lowercase letter, digits, and a special symbol and that string
will store in password variable.

The second loop will generate a random string of length entered by the user –
4 and add to the password variable. Here we minus 4 to the length of the user
because we already generate the string of length 4.
We have done this because we want a password which must contain an
uppercase, a lowercase, a digit, and a special symbol.

Now the password is set to the pass_str() variable.

Button(root, text = "GENERATE PASSWORD" , command = Generator ).pack(pady= 5)

Entry(root , textvariable = pass_str).pack()

1 Button() widget used to display button on our window


2 command is called when the button is click
3 Entry() widget used to create an input text field
4 textvariable used to retrieve the current text to the entry widget

5. Function to Copy Password


def Copy_password():
pyperclip.copy(pass_str.get())

Button(root, text = 'COPY TO CLIPBOARD', command = Copy_password).pack(pady=5)Python

Summary
With these steps, we have successfully created a random password generator
project using python. We used popular tkinter library to rendering graphics in
our display window and we also learned about pyperclip and random library.

We learned how to create buttons, input textfield, labels, and spinbox. In this
way, we successfully created our password generator python project. Hope you
enjoyed it.

You might also like