PRO COMP
PRO COMP
2|P a ge
THIS IS TO HEREBY CERTIFY THAT “HARSH SAINI”
OF CLASS XII(SCI) OF SHRI RAM SHIKSHA MANDIR
HAS COMPLETED HIS PROJECT ON THE TOPIC
VOICE ASSISTANT BY PYTHON UNDER THE
GUIDANCE OF MR. ANKUR GARG. HE HAS TAKEN
PROPER CARE AND SHOWN UTMOST SINCERITY IN
COMPLETING THIS PROJECT. I CERTIFY THAT THIS
PROJECT IS UPTO MY EXPECTATIONS AND AS PER
THE GUIDELINES OF CBSE.
3|P a ge
I would like to express my special gratitude to
the principal MS. NEETU MUNJAL, for her
encouragement and for all the support that she
provided for this work. I am grateful to my
teacher MR. ANKUR GARG
for supporting me throughout completion of
this project.
4|P a ge
5|P a ge
6|P a ge
7|P a ge
WORKING ENVIRONMENT
8|P a ge
Simple and Readable Syntax: Python's syntax is clear and easy
to learn, making it an ideal language for beginners. Its code is
often compared to plain English, allowing for easier understanding
and maintenance.
9|P a ge
Web Development: Frameworks like Django and
Flask make Python a great choice for building web
applications.
10 | P a g e
To begin with, you need to install Python on your computer. You can download the latest version of Python
from the official Python website
1. Visit python.org
2. Navigate to the “download”
section
3. Select the appropriate version
of your operating system (win,
macOS or Linux)
4. Download the installer file
WINDOWS:
a) Run the installer file you
downloaded.
b) Make sure to click the box that
says “Add python to path”.
11 | P a g e
MacOS:
a) 0pen the downloaded .pkg file.
b) Follow the installation instructions.
c) Python should be added in your path.
LINUX:
a) Open the terminal.
b) Use the package manager specific to your
distribution.
13 | P a g e
With Python installed and your
development environment set up, you
can start writing and running Python
code.
• In PyCharm:
Create a new Python file (.py) in your project.
Write your Python code in the file.
Run the code by right-clicking the file and
selecting "Run" or by using the run button.
• In VS Code:
Create a new Python file (.py).
Write your Python code in the file.
Run the code by pressing F5 or by opening
the terminal in VS Code and typing: [
python filename.py ]
By following these steps, you will have Python installed and a
development environment set up, ready for you to start coding and
developing your Hotel Management System.
14 | P a g e
Python scripts are simple text files with a .py extension.
These scripts can be written in any text editor or integrated
development environment (IDE). Once written, you can
execute these scripts using the command line or within the
IDE itself.
You can use a basic text editor like Notepad (Windows), TextEdit
(macOS), or Nano/Vim (Linux).
Alternatively, you can use an IDE like PyCharm or a text editor with
Here’s an example of a simple Python script that prints "Hello, World!" to the console: #
hello_world.py print("Hello, World!")
15 | P a g e
Open the command line:
On Windows, open Command Prompt.
On macOS, open Terminal.
On Linux, open Terminal.
Variables in Python
Variables are used to store information that can be
referenced and manipulated throughout a program.
In Python, variables do not require explicit
declaration to reserve memory space. Instead, the
declaration happens automatically when a value is
assigned to the variable.
17 | P a g e
Key Points about Variables in
Python:
Dynamic Typing:
Python is dynamically typed, meaning you do not
need to specify the type of variable. The type is
inferred from the value assigned to it.
Assignment:
You can assign a value to a variable using the =
operator.
Reassignment:
Variables can be reassigned to different values, and
even different data types, at any point in the
program.
18 | P a g e
Naming Conventions:
EXAMPLE:
19 | P a g e
Explanation of the Example:
Initial Assignment:
Variables x, y, name, and is_student are assigned
values of different data types (integer, float,
string, and Boolean, respectively).
Printing Variables:
The print function is used to display the values of
the variables.
Reassignment:
The values of x and name are changed to 20 and
"Bob", respectively.
Dynamic Typing:
The variable z is first assigned a string value "Hello"
and later reassigned to an integer value 42. Python
handles the change in data type automatically.
20 | P a g e
21 | P a g e
22 | P a g e
23 | P a g e
24 | P a g e
25 | P a g e
26 | P a g e
27 | P a g e
28 | P a g e
29 | P a g e
30 | P a g e
31 | P a g e
32 | P a g e
33 | P a g e
34 | P a g e
35 | P a g e
36 | P a g e
Functions are reusable blocks of code that perform specific tasks. They allow you to structure
your code into modular units, making it easier to manage and reuse. Python supports both built-in
functions (like print (), Len (), type (), etc.) and user-defined functions.
Defining Functions
To define a function in Python, you use the def keyword followed by the function name and
parentheses containing optional parameters. The function body is indented and contains the code to
be executed.
Example: Defining and Calling a Function
37 | P a g e
Built-in Functions
Python comes with a set of built-in functions that are ready to use without the need for defining
them. Some commonly used built-in functions include:
38 | P a g e
User-defined Functions
You can also create custom functions tailored to your specific needs. These are called user-
defined functions.
Example: Creating a User-defined Function (new
customer)
39 | P a g e
Modules in Python are files containing Python code. This code can define functions, classes, and
variables that can be used in other Python programs. Modules help organize code into reusable
units and facilitate modular programming.
Introduction to Using Modules
To use a module in Python, you typically import it using the import statement. There are
different ways to import modules:
40 | P a g e
Common Modules in Python
Python's standard library includes a wide range of modules that provide ready-to-use functions
and classes for various tasks. Some common modules include:
41 | P a g e
Modules USED
SPEECH_RECPRGNITION
In Python, speech recognition allows the conversion of spoken language into text, which can be
used in various applications like virtual assistants, transcription tools, or voice-controlled
systems.
PYTTSX3
pyttsx3 is a Python library that converts text to speech (TTS). It is platform-independent and
works offline, meaning it doesn't require an internet connection. Unlike some other TTS
libraries (like Google Text-to-Speech), pyttsx3 uses the text-to-speech engine installed on
your system and can work with voices provided by the operating system.
DATETIME
In Python, the datetime module is used to work with dates and times. It provides a variety of
classes and functions to manipulate dates and times, perform date arithmetic, and format or parse
dates.
42 | P a g e
Python, the Wikipedia library is a great option. It allows you to easily access and retrieve
information from Wikipedia pages programmatically. This can be useful for various applications,
including bots, data scraping, or simply retrieving information for personal projects.
WEBBROWSER
This module can facilitate browsing the internet, interacting with web pages, scraping data, or
automating web tasks. Below are some key aspects and libraries associated with creating web
browsers or web interactions in Python.
In Python, the os module is a standard library that provides a way of using operating system-
dependent functionality like reading or writing to the file system, interacting with the
environment variables, and performing various system-level operations. It is essential for tasks
that require interaction with the operating system.
SMTPLIMB
The smtplib module in Python is a built-in library used for sending emails using the Simple Mail Transfer Protocol
(SMTP). This module provides functions to create an SMTP client session object, which can be used to send mail to any
internet machine with an SMTP/ESMTP listener daemon.
MIMETEXT
The MIMEText class, which is part of the email.mime.text module in the Python standard
library, is specifically used to create MIME-formatted email messages with plain or HTML
text content.
43 | P a g e
MIMEMultipart is a class in the email.mime.multipart module of Python's standard library that
is used to create multipart email messages. It allows you to send emails that contain multiple
parts, such as plain text, HTML content, and attachments.
REQUESTS
The requests module in Python is a popular and user-friendly library designed for making HTTP requests.
It simplifies the process of sending requests to web servers and receiving responses. The library abstracts
the complexities of handling URL connections, HTTP methods, session management, and more, making it a
preferred choice for web developers and data scientists when interacting with APIs or web scraping.
JSON
The json module in Python is a built-in library that provides functions for working with JSON (JavaScript
Object Notation) data. JSON is a lightweight data interchange format that is easy for humans to read and
write and easy for machines to parse and generate
44 | P a g e
FUNCTIONS USED
Speak(audio):
The speak (audio) function in Python is typically used in applications where there is a need to
convert text to speech (TTS). This function is particularly useful in creating voice assistants,
accessibility tools, educational applications, and any other software that benefits from audio
output.
Greet_user():
The greet_user() function in Python (or any programming language) is typically a custom
function designed to provide a personalized greeting to users.
Take _command():
The take_command function in Python is typically used in the context of voice recognition
applications, particularly those that involve creating voice assistants or chatbots. This function is
designed to capture and process spoken input from the user, converting it into text for further
analysis or action.
45 | P a g e
Sendmail():
The sendmail function in Python is commonly used to send emails programmatically. It is typically
part of the smtplib module, which provides a simple way to connect to an SMTP (Simple Mail
Transfer Protocol) server and send emails from a Python application.
Open_website():
The open website function in Python is typically used to programmatically launch a web browser
and navigate to a specified URL. This functionality can be useful in various scenarios, such as
automating web tasks, testing web applications, or providing users with direct links to resources.
The run_assistant function in Python is typically associated with voice assistants or chatbot
applications. This function is responsible for initiating and managing the main loop of the assistant,
allowing it to listen for user input, process commands, and respond appropriately.
46 | P a g e
HARDWARE AND SOFTWARE
SPECIFICATIONS USED
47 | P a g e
48 | P a g e
49 | P a g e
50 | P a g e
51 | P a g e
52 | P a g e
53 | P a g e
54 | P a g e
55 | P a g e
56 | P a g e
57 | P a g e
OUTPUT
58 | P a g e
59 | P a g e
60 | P a g e
61 | P a g e
62 | P a g e
63 | P a g e
64 | P a g e
65 | P a g e
66 | P a g e
67 | P a g e
68 | P a g e
69 | P a g e
70 | P a g e
71 | P a g e
72 | P a g e
73 | P a g e
74 | P a g e
75 | P a g e
76 | P a g e
77 | P a g e
78 | P a g e
79 | P a g e
80 | P a g e
81 | P a g e
82 | P a g e
83 | P a g e