Sample CS Project Documentation
Sample CS Project Documentation
Baad (Mathura)
Project Report on
Jarvis Ai Assistant
ROLL NO : 4
CLASS : XII A3
CERTIFICATE
This is to certify that Mr.Devesh Dixit Roll No: 4 has successfully completed the project Work
entitled Jarvis Ai in the subject Computer Science (083) laid down in the regulations of CBSE for the
purpose of Practical Examination in Class XII to be held in Kanha Makhan Public School,
_________________________
(Uma Shankar)
PGT Computer Science
Examiner:
Name: _______________
Signature: _______________
ACKNOWLEDGEMENT
Apart from the efforts of me, the success of any project depends largely on the encouragement and
guidelines of many others. I take this opportunity to express my gratitude to the people who have
been instrumental in the successful completion of this project.
I express deep sense of gratitude to almighty God for giving me strength for the successful
completion of the project.
I express my heartfelt gratitude to my parents for constant encouragement while carrying out
this project.
I gratefully acknowledge the contribution of the individuals who contributed in bringing this
project up to this level, who continues to look after me despite my flaws,
I express my deep sense of gratitude to the luminary The Principal, Kanha Makhan Public
School, Township (Mathura) who has been continuously motivating and extending their helping hand
to us.
My sincere thanks to Mr. Uma Shankar, Project guide, Mentor all the above a friend, who
critically reviewed my project and helped in solving each and every problem, occurred during
implementation of the project
The guidance and support received from all the members who contributed and who are
contributing to this project, was vital for the success of the project. I am grateful for their constant
support and help.
About Project
I Made an AI Which Can Perform Various Task Which is already feed in Program And It Made With The Help
Of Python’s Module Like “Speech_Recognizition” Which Help in listening of voice input from the user,
processes the audio, and converts it into text using Google’s speech recognition API. If no input is detected or
an error occurs, the function handles exceptions to ensure smooth operation. And Also “Pyttsx3” the pyttsx3
library Helps to convert text into speech. This is how Jarvis communicates back to the user with verbal
responses. When the program is initiated, it greets the user, displays a menu of available tasks, and waits for the
user to issue commands. The commands are mapped to various functions that execute specific actions, such as
opening a website or playing a game. Jarvis continuously listens for commands and processes them by
comparing recognized speech with predefined phrases or keywords. The program responds by calling
appropriate functions based on the input.
The provided program is a voice-activated AI assistant named Jarvis that can perform a variety of tasks to
assist users with various activities. Here's a breakdown of what the program can do:
1. Web Browsing 🌐
2. Entertainment 🎶
Play Music: Jarvis can play songs on YouTube based on your voice request.
Truth and Dare: A game where Jarvis will ask you to choose between truth or dare. It keeps track of the results
and logs responses.
Chat with Jarvis: You can engage in a conversation with Jarvis. It has a set of predefined responses to common
questions and topics.
Number Guessing Game: A fun game where Jarvis will generate a random number, and you have to guess it.
Riddles: Jarvis will present a riddle and will wait for your answer.
Rock-Paper-Scissors: Jarvis can play the classic game of rock-paper-scissors with you.
Take a Quiz: A quiz with multiple-choice questions on various topics, where Jarvis will give you feedback on your
answers.
3. Productivity 📈
Calculator: You can ask Jarvis to perform simple mathematical calculations by speaking the expression.
Create a Text File: Jarvis can create a text file and write content to it, based on your voice input.
View Current Date and Time: Jarvis can tell you the current date and time in a formatted manner.
Set a Timer: You can set a timer in seconds, and Jarvis will notify you when the time is up.
4. Applications 📊
Open Applications: Jarvis can open specific applications like Notepad, Calculator, and Paint.
Close Applications: You can ask Jarvis to close applications such as Notepad, Calculator, and Paint.
5. Miscellaneous Features 🤖
Voice Interaction 🎤
Voice Recognition: Jarvis listens to commands and responds using text-to-speech. It supports voice input for
commands like searching on Google, playing games, opening apps, and many other tasks.
Log Responses: For games like Truth and Dare, Jarvis logs responses in a file (e.g., "truth_and_dare_log.txt").
Real-Time Functionality ⏳
Overall, this program combines voice control with multiple practical and entertainment features, making it a
versatile assistant. You can interact with it via speech to browse the web, play games, perform calculations,
open applications, and more.
HARDWARE AND SOFTWARE USED
HARDWARE
RAM : 2 GB
Monitor : USB
SOFTWARE
.
What is Python
Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-
level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for
Rapid Application Development, as well as for use as a scripting or glue language to connect existing
components together. Python's simple, easy to learn syntax emphasizes readability and therefore reduces the
cost of program maintenance. Python supports modules and packages, which encourages program modularity
and code reuse. The Python interpreter and the extensive standard library are available in source or binary form
without charge for all major platforms, and can be freely distributed.
Often, programmers fall in love with Python because of the increased productivity it provides. Since there is no
compilation step, the edit-test-debug cycle is incredibly fast. Debugging Python programs is easy: a bug or bad
input will never cause a segmentation fault. Instead, when the interpreter discovers an error, it raises an
exception. When the program doesn't catch the exception, the interpreter prints a stack trace. A source level
debugger allows inspection of local and global variables, evaluation of arbitrary expressions, setting
breakpoints, stepping through the code a line at a time, and so on. The debugger is written in Python itself,
testifying to Python's introspective power. On the other hand, often the quickest way to debug a program is to
add a few print statements to the source: the fast edit-test-debug cycle makes this simple approach very
effective.
Advantages of Python
For Beginners, Python is simple to understand and use. It's a highly developed programming language with an
English-like syntax. The language is simple to adapt as a result of these factors. Because of its simplicity,
Python's fundamentals can be implemented faster than those in other programming languages.
Python is distributed under an open-source license approved by the Open-Source Initiative (OSI). As a result,
users can work on it and distribute it. Users can download the source code, modify it, and even distribute their
Python version. Companies that wish to modify a specific behavior and build their version will benefit.
Rapid Development
Users can create new kinds of applications using the Python programming language. Because of its versatility,
this language permits the operator to try new things. Because of the language, the user is not prevented from
trying something new. Python is favored in these scenarios since other programming languages lack the
flexibility and freedom that Python does.
Interpreted Language
Python is an interpreted language, implying that the code is implemented line by line. This is one of the features
that makes it simple to use. In the event of an error, it halts the process and reports the problem. Python only
shows one error, even if the program has multiple errors. This makes debugging easier.
Dynamically Typed
Until we run the program, Python has no idea what kinds of parameter we're talking about. It allocates the data
type automatically during execution. Variables and their data types do not need to be declared by the
programmer.
Portability
Many other languages, including C/C++, demand that user must change their code to run on different platforms.
Python, on the contrary, is not equivalent to other programming languages. It only needs to be written once, and
then it can be run anywhere. However, the user should avoid involving any system-dependent features.
Python is a programming language generated many years ago and has a large community that can assist
programmers of all experience levels, from rookies to specialists. Python's community has helped it grow
quickly in comparison to other languages. The Python programming language comes with many guides,
instructional videos, and highly understandable documentation to help developers learn the language faster and
more effectively.
Applications of Python
Here are the most common applications of Python in the world of programming.
Visualization of data
Another popular and growing area of interest is data visualization. Again, it plays to many of Python's strengths.
Python, in addition to its flexibility and open-source nature, offers a wide range of graphic libraries with a
variety of features.
Python is a stable, versatile, easy yet effective programming language that is ideal for various machine learning
(ML) and artificial intelligence (AI) projects. Thanks to the abundance of Python machine learning and artificial
intelligence libraries and packages, python is undoubtedly one of the most widely used programming languages
among data analysts and data scientists.
Data Analytics
Python makes sense for data science and analytics. The language is simple to learn, flexible, and very well
supported, making it quick and simple to use for data analysis. It's useful for attempting to manipulate data and
performing repetitive tasks when working directly with huge amounts of data.
Desktop GUI
Python is a much more interactive language for programmers than other languages that enable developers to
quickly and easily create graphical user interfaces. It includes many built-in tools such as PyQT, wxWidgets,
kivy, and many other packages and libraries that can be used to create a fully operational GUI efficiently and
securely.
Web Development
Web design and development using Python is very efficient. This is largely due to the innumerable Python web
development paradigms, such as Django, Flask, and Piramyd that are available. These frameworks have been
used by sites and services such as Spotify, Reddit, and Mozilla.
Python's audio and visual applications are, without a doubt, its most impressive feature. Python comes with
many frameworks and functions to help us complete our tasks flawlessly. Netflix, Hubspot, and YouTube are
just a few examples of Python-based applications. Libraries like Mignus, Dejavu, Pyo, SciPy, and OpenCV can
help.
CAD Applications
Digitally created 3D and 2D models. Architects, construction managers, and product designers use this
application to build things with extremely high consistency, which has replaced manual drift. Python comes
pre-installed with fantastic applications such as Blender, Open Cascade, FreeCAD, and many others that help us
design products quickly. Technical drawing, dynamic system development and import are all enhanced features.
Scientific Computing
Python is becoming more widely used in finance, particularly in domains such as qualitative data analysis and
qualitative analysis. It can be a useful tool for predicting asset price trends, automating workflows across
multiple data sources, and deciding asset price patterns and predictions.
Web scraping is a fully automated method of extracting data from webpages in a more efficient and timely
manner. Researchers, organizations, and analysts use the data for a wide range of purposes. Python has a
number of characteristics that make it ideal for web scraping, including:
o Game Development
o Internet of Things (IoT)
o Network Programming
o Robotics
o Natural Language Processing (NLP)
Real-World examples for Python applications
Python is used everywhere now a days. The real-world example tasks performed by Python applications are
given below.
Dropbox - Building and maintaining the file hosting service's server infrastructure.
Spotify - Data analysis, recommendation systems, and backend services in the music streaming platform.
Instagram - Backend infrastructure and data processing in the popular social media platform.
import webbrowser
import pyttsx3
import random
import os
import datetime
import time
tell = pyttsx3.init()
r = sr.Recognizer()
def speak(text):
tell.say(text)
tell.runAndWait()
def listen():
try:
with sr.Microphone() as source:
print("Listening....")
audio = r.listen(source, timeout=12, phrase_time_limit=15)
print("Recognizing...")
command = r.recognize_google(audio)
print(f"You Said: {command}")
return command
except Exception as e:
print(f"Error: {e}")
return ""
def s(x=30):
time.sleep(x)
def menu():
speak("Now Menu will Apear So It Take Some time to Initialize Perfectly... ")
print("\n" + "="*30)
print(" Jarvis Menu")
print("="*30)
print(" **Web Browsing** 📊")
print(" 1. Open Google 🌐")
print(" 2. Open Facebook 👥")
print(" 3. Open Instagram 📸")
print(" 4. Open YouTube 📺")
print(" 5. Open Email 📧")
print(" 6. Open Twitter 🐦")
print(" 7. Open Reddit 📖")
print(" 8. Search on Google 🔍")
print(" 9. Search on YouTube 🎥")
s(5)
print("\n **Entertainment** 🎵")
print(" 10. Play Music 🎶")
print(" 11. Truth and Dare 😜")
print(" 12. Chat with me! 💬")
print(" 13. Play a number guessing game 🎲")
print(" 14. Solve a riddle 🧩")
print(" 15. Play rock-paper-scissors ✊")
print(" 16. Take a quiz 📝")
s(5)
print("\n **Productivity** 📊")
print(" 17. Calculate 📝")
print(" 18. Create a new text file 📄")
print(" 19. View current date and time 🕒")
print(" 20. Set a timer ⏳")
s(5)
print("\n **Applications** 📈")
print(" 21. Open Application 📊")
print(" 22. Close Application ❌")
s(5)
print("\n **Help** 🤔")
print(" 23. Show Help")
s(2)
print("\n **About** 🤔")
print(" 24. About Jarvis")
s(2)
print("\n **Exit** 👋")
print(" 99. Exit Jarvis")
print("="*30)
def about():
print("\n" + "="*30)
print(" About Jarvis")
print("="*30)
print(" Created by: Devesh Dixit")
print(" Assisted by: Sumit Kumar")
print(" Version: 1.0")
print(" Jarvis is an AI assistant designed to help you with tasks and keep you
company!")
print("="*30)
def login():
print("Welcome to Jarvis!")
speak("Welcome to Jarvis! Please tell me your name.")
name = listen()
print(f"Hello, {name}! How can I assist you today?")
speak(f"Hello, {name}! How can I assist you today?")
return name
def chat():
responses = {
"how are you": "I'm doing fantastic! Thank you for asking. How about you?",
"what's your name": "I'm Jarvis, your loyal assistant! I'm here to help you
with anything you need.",
"what do you like": "I enjoy chatting with you and helping you with your
tasks! It's always fun to assist.",
"tell me a joke": "Why don't scientists trust atoms? Because they make up
everything! Haha, get it?",
"i love you": "Aww, I love you too! You're the best!",
"what are you doing": "I'm just hanging out, waiting for you to talk to me!
What's on your mind?",
"what's your favorite color": "I think I'd love blue! It reminds me of the
sky on a clear day.",
"tell me something interesting": "Did you know honey never spoils?
Archaeologists have found pots of honey in ancient Egyptian tombs that are over 3000
years old and still perfectly edible!",
"what's your favorite movie": "I love all the classic sci-fi movies! They
always spark my imagination.",
"what's your favorite food": "I think I'd enjoy pizza. It's so popular!
What's yours?",
"do you have a favorite song": "I think I'd love any song that makes you
happy. Music is such a beautiful art!",
"tell me about yourself": "I'm an AI designed to assist you, learn from you,
and entertain you. What about you? Tell me something about yourself!"
}
speak("I'm here to chat! What would you like to talk about? You can ask me
anything or just say 'exit' to stop chatting.")
while True:
command = listen().lower()
if "exit" in command or "stop" in command:
speak("Alright, I'm here whenever you need me! Just say my name to talk
again.")
break
def search_google():
speak("What do you want to search on Google?")
query = listen()
webbrowser.open(f"https://www.google.com/search?q={query}")
speak(f"Searching Google for {query}")
def search_youtube():
speak("What do you want to search on YouTube?")
query = listen()
webbrowser.open(f"https://www.youtube.com/results?search_query={query}")
speak(f"Searching YouTube for {query}")
def number_guessing_game():
number_to_guess = random.randint(1, 100)
attempts = 0
speak("Welcome to the number guessing game! I'm thinking of a number between 1
and 100. Can you guess what it is?")
print("Number Guessing Game Started! Guess the number between 1 and 100.")
while True:
speak("Please say your guess.")
guess = listen()
attempts += 1
if guess.isdigit():
guess = int(guess)
if guess < number_to_guess:
speak("Too low! Try again.")
print("Jarvis: Too low! Try again.")
elif guess > number_to_guess:
speak("Too high! Try again.")
print("Jarvis: Too high! Try again.")
else:
speak(f"Congratulations! You've guessed the number {number_to_guess}
in {attempts} attempts!")
print(f"Jarvis: Congratulations! You've guessed the number
{number_to_guess} in {attempts} attempts!")
break
else:
speak("Please say a valid number.")
def solve_riddle():
riddle, answer = ("I speak without a mouth and hear without ears. I have no body,
but I come alive with the wind. What am I?", "echo")
speak(riddle)
print(f"Jarvis: {riddle}")
while True:
speak("What is your answer?")
user_answer = listen().lower()
if user_answer == answer:
speak("Correct! You solved the riddle! 🎉")
print("Jarvis: Correct! You solved the riddle! 🎉")
break
else:
speak("That's not quite right. Try again!")
print("Jarvis: That's not quite right. Try again.")
def play_rock_paper_scissors():
options = ["rock", "paper", "scissors"]
speak("Let's play rock-paper-scissors! Say your choice.")
user_choice = listen().lower()
if user_choice not in options:
speak("That's not a valid choice. Please say rock, paper, or scissors.")
return
computer_choice = random.choice(options)
speak(f"I chose {computer_choice}.")
if user_choice == computer_choice:
speak("It's a tie! We both chose the same thing.")
elif (user_choice == "rock" and computer_choice == "scissors") or \
(user_choice == "paper" and computer_choice == "rock") or \
(user_choice == "scissors" and computer_choice == "paper"):
speak("You win! 🎉")
else:
speak("I win! Better luck next time!")
def take_quiz():
questions = {
"What is the capital of France?": "paris",
"What is 5 + 7?": "12",
"Who wrote 'Romeo and Juliet'?": "shakespeare",
"What is the largest planet in our solar system?": "jupiter",
"What year did the Titanic sink?": "1912",
"What is the chemical symbol for water?": "h2o",
"Who painted the Mona Lisa?": "da vinci",
"What is the smallest prime number?": "2"
}
score = 0
for question, answer in questions.items():
speak(question)
print(f"Jarvis: {question}")
user_answer = listen().lower()
if user_answer == answer:
speak("Correct! 🎉")
print("Jarvis: Correct! 🎉")
score += 1
else:
speak(f"Sorry, the correct answer is {answer}.")
print(f"Jarvis: Sorry, the correct answer is {answer}.")
def open_application():
speak("Which application do you want to open?")
app_name = listen().lower()
apps = {
"notepad": "notepad.exe",
"calculator": "calc.exe",
"paint": "mspaint.exe",
}
if app_name in apps:
try:
os.startfile(apps[app_name])
speak(f"Opening {app_name}.")
speak(f"{app_name} Successfully opened")
except Exception as e :
speak("Sorry ,Some error occured... ")
else:
try:
os.startfile(f"{app_name}.exe")
speak("Successfully opened")
except Exception as e :
print("error occured ")
def close_application():
speak("Which application do you want to close?")
app_name = listen().lower()
if app_name == "notepad":
os.system(f"taskkill /im notepad.exe")
speak("Closed Successfully...")
elif app_name=="calculator":
os.system(f"taskkill /im calc.exe")
speak("Closed Successfully")
elif app_name=="paint":
os.system(f"taskkill /im mspaint.exe")
speak("Closed Succesfully")
else:
os.system(f"taskkill /im {app_name}.exe")
speak(f"Closing {app_name}.")
def calculate():
speak("What calculation do you want to perform? Please say your expression.")
expression = listen()
try:
result = eval(expression)
speak(f"The result is {result}.")
print(f"Result is :{result}")
print(f"Jarvis: The result is {result}.")
except Exception as e:
speak("There was an error with your calculation.")
print(f"Jarvis: There was an error with your calculation. {e}")
def create_text_file():
speak("What should I name the text file?")
filename = listen() + ".txt"
def view_datetime():
current_time = datetime.datetime.now()
formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S")
speak(f"The current date and time is {formatted_time}.")
print(f"Jarvis: The current date and time is {formatted_time}.")
def set_timer():
speak("How many seconds do you want to set the timer for?")
timer_seconds = listen()
if timer_seconds.isdigit():
timer_seconds = int(timer_seconds)
speak(f"Setting a timer for {timer_seconds} seconds.")
time.sleep(timer_seconds)
speak("Time's up! The timer has finished.")
print("Jarvis: Time's up! The timer has finished.")
else:
speak("Please say a valid number.")
def truth_and_dare():
speak("Welcome to the Truth and Dare game!")
speak("How many players are playing the game? Please Type ")
num_players= input(":").strip()
players = []
num_players=int(num_players)
for i in range(num_players):
speak(f"Player {i+1}, what is your name?")
print(f"Player {i+1}, please enter your name:")
player_name = listen()
players.append(player_name)
player = random.choice(players)
speak(f"{player}, it's your turn!")
print(f"{player}, it's your turn!")
def ch(player):
speak(f"{player}, would you like to choose truth or dare on your own, or would
you like Jarvis to help you?")
print(f"{player}, do you want help from Jarvis? (yes/no)")
choice = listen().lower()
if "yes" in choice:
speak("Jarvis is helping you choose. Let's pick a random truth or dare!")
print(f"Jarvis is helping {player}...")
speak("Jarvis gives you two options: truth or dare. Please choose one.")
print("Choose 'truth' or 'dare'.")
player_choice = listen().lower()
if "truth" in player_choice:
truth_questions = [
"What is your biggest fear?",
"What is the most embarrassing thing you've ever done?",
"What is your most awkward moment?",
"What is something you’ve never told anyone?"
]
question = random.choice(truth_questions)
speak(f"Your truth question is: {question}")
print(f"Truth: {question}")
answer = listen()
result = f"{player} answered: {answer}"
response = listen().lower()
if "done" in response:
result = f"{player} completed the dare: {challenge}"
else:
result = f"{player} skipped the dare: {challenge}"
else:
speak("Invalid choice. Please choose 'truth' or 'dare'.")
print(f"{player}, please choose 'truth' or 'dare'.")
return
with open("truth_and_dare_log.txt", "a") as file:
file.write(f"{datetime.datetime.now()} - {player} chose:
{player_choice if 'truth' in player_choice or 'dare' in player_choice else 'truth or
dare'} - {result}\n")
speak(f"I have saved your response, {player}")
else:
speak(f"Alright, {player}, make your choice. Truth or dare? , And
complete this Round Without me ")
s(20)
speak("If this ROund is Completed then Shall be begin ..")
c=listen().lower()
if c=="yes":
pass
else :
command=listen().lower()
ch(player)
def main():
name = login()
menu()
speak("Listening.....")
while True:
command = listen().lower()
if __name__ == "__main__":
main()
OUTPUT
BIBLIOGRAPHY