Surya Nsh
Surya Nsh
r a
io r
n
y
Jyoti Se
Sch l
oo
2024 - 2025
Topic:
Teacher Incharge
Characteristics of Python
Following are important characteristics of Python Programming −
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.
IP INVESTIGATORY
PROJECTON JARVIS AI SMART DESKTOP
Hello World using Python.
Just to give you a little excitement about Python, I'm going to give you a small conventional
Python Hello World program, You can try it using Demo link.
Live Demo
print ("Hello, Python!");
Applications of Python
As mentioned before, Python is one of the most widely used language over the web. I'm going
to list few of them here:
Easy-to-learn − Python has few keywords, simple structure, and a clearly defined
syntax. This allows the student to pick up the language quickly.
Easy-to-read − Python code is more clearly defined and visible to the eyes.
Easy-to-maintain − Python's source code is fairly easy-to-maintain.
A broad standard library − Python's bulk of the library is very portable and cross-
platform compatible on UNIX, Windows, and Macintosh.
Interactive Mode − Python has support for an interactive mode which allows
interactive testing and debugging of snippets of code.
Portable − Python can run on a wide variety of hardware platforms and has the same
interface on all platforms.
Extendable − You can add low-level modules to the Python interpreter. These modules
enable programmers to add to or customize their tools to be more efficient.
Databases − Python provides interfaces to all major commercial databases.
GUI Programming − Python supports GUI applications that can be created and ported
to many system calls, libraries and windows systems, such as Windows MFC,
Macintosh, and the X Window system of Unix.
Scalable − Python provides a better structure and support for large programs than
shell scripting.
IP INVESTIGATORY
PROJECTON JARVIS AI SMART DESKTOP
What is a Database?
A database is a separate application that stores a collection of data. Each database has one
or more distinct APIs for creating, accessing, managing, searching and replicating the data it
holds.
Other kinds of data stores can also be used, such as files on the file system or large hash
tables in memory but data fetching and writing would not be so fast and easy with those type
of systems.
Nowadays, we use relational database management systems (RDBMS) to store and manage
huge volume of data. This is called relational database because all the data is stored into
different tables and relations are established using primary keys or other keys known as
Foreign Keys.
A Relational DataBase Management System (RDBMS) is a software that −
Enables you to implement a database with tables, columns and indexes.
Guarantees the Referential Integrity between rows of various tables.
Updates the indexes automatically.
Interprets an SQL query and combines information from various tables.
RDBMS Terminology
Before we proceed to explain the MySQL database system, let us revise a few definitions
related to the database.
Database − A database is a collection of tables, with related data.
Table − A table is a matrix with data. A table in a database looks like a simple
spreadsheet.
Column − One column (data element) contains data of one and the same kind, for
example the column postcode.
Row − A row (= tuple, entry or record) is a group of related data, for example the data
of one subscription.
Redundancy − Storing data twice, redundantly to make the system faster.
Primary Key − A primary key is unique. A key value can not occur twice in one table.
With a key, you can only find one row.
Foreign Key − A foreign key is the linking pin between two tables.
IP INVESTIGATORY
PROJECTON JARVIS AI SMART DESKTOP
Compound Key − A compound key (composite key) is a key that consists of multiple
columns, because one column is not sufficiently unique.
Index − An index in a database resembles an index at the back of a book.
Referential Integrity − Referential Integrity makes sure that a foreign key value always
points to an existing row.
MySQL Database
MySQL is a fast, easy-to-use RDBMS being used for many small and big businesses. MySQL is
developed, marketed and supported by MySQL AB, which is a Swedish company. MySQL is
becoming so popular because of many good reasons −
MySQL is released under an open-source license. So you have nothing to pay to use it.
MySQL is a very powerful program in its own right. It handles a large subset of the
functionality of the most expensive and powerful database packages.
MySQL uses a standard form of the well-known SQL data language.
MySQL works on many operating systems and with many languages including PHP,
PERL, C, C++, JAVA, etc.
MySQL works very quickly and works well even with large data sets.
MySQL is very friendly to PHP, the most appreciated language for web development.
MySQL supports large databases, up to 50 million rows or more in a table. The default
file size limit for a table is 4GB, but you can increase this (if your operating system can
handle it) to a theoretical limit of 8 million terabytes (TB).
MySQL is customizable. The open-source GPL license allows programmers to modify
the MySQL software to fit their own specific environments.
IP INVESTIGATORY
PROJECTON JARVIS AI SMART DESKTOP
DEBUGGING
#JARVIS PROGRAM 1
import pyaudio
import speech_recognition as sr
from pygame import mixer
import os
import random
import socket
import webbrowser
import subprocess
import glob
IP INVESTIGATORY
PROJECTON JARVIS AI SMART DESKTOP
from time import localtime, strftime
import speekmodule
doss = os.getcwd()
i=0
n=0
INFO = '''
+=======================================+
|.....JARVISE VIRTUAL INTELLIGENCE......|
+---------------------------------------+
|#Author:Aditya singh |
|#Date: 15/09/2019 |
|#Changing the Description of this tool |
| Won't made you the coder |
|#EAT CODE SLEEP REPEAT |
+---------------------------------------+
|.....JARVISE VIRTUAL INTELLIGENCE......|
+=======================================+
| OPTIONS: |
|#hello/hi #goodbye #sleep mode |
|#your name #jarvis #what time |
|#asite.com #next music #music |
|#pause music #wifi #thank you |
|#start/stop someapp |
|#pip install/uninstall anapp |
|#googlemaps tanyplace |
+=======================================+
IP INVESTIGATORY
PROJECTON JARVIS AI SMART DESKTOP
'''
print(INFO)
# JARVIS'S
EARS======================================================================
==================================== SENSITIVE BRAIN
# obtain audio
while (i<1):
r = sr.Recognizer()
with sr.Microphone() as source:
audio = r.adjust_for_ambient_noise(source)
n=(n+1)
print("Say something!")
audio = r.listen(source)
# interprete audio (Google Speech Recognition)
try:
s = (r.recognize_google(audio))
message = (s.lower())
print (message)
# POLITE JARVIS
===========================================================================
================================== BRAIN 1
if ('goodbye') in message:
rand = ['Goodbye Sir', 'Jarvis powering off in 3, 2, 1, 0']
speekmodule.speek(rand,n,mixer)
break
IP INVESTIGATORY
PROJECTON JARVIS AI SMART DESKTOP
if ('hello') in message or ('hi') in message:
rand = ['Wellcome to Jarvis virtual intelligence project. At your service sir.']
speekmodule.speek(rand,n,mixer)
if message == ('jarvis'):
rand = ['Yes Sir?', 'What can I doo for you sir?']
speekmodule.speek(rand,n,mixer)
if ('how are you') in message or ('and you') in message or ('are you okay') in message:
rand = ['Fine thank you']
speekmodule.speek(rand,n,mixer)
if ('*') in message:
rand = ['Be polite please']
speekmodule.speek(rand,n,mixer)
# USEFUL JARVIS
===========================================================================
================================== BRAIN 2
if ('wi-fi') in message:
IP INVESTIGATORY
PROJECTON JARVIS AI SMART DESKTOP
REMOTE_SERVER = "www.google.com"
speekmodule.wifi()
rand = ['We are connected']
speekmodule.speek(rand,n,mixer)
if ('.com') in message :
rand = ['Opening' + message]
Chrome = ("C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s")
speekmodule.speek(rand,n,mixer)
webbrowser.get(Chrome).open('http://www.'+message)
print ('')
if ('install') in message:
query = message
stopwords = ['install']
querywords = query.split()
resultwords = [word for word in querywords if word.lower() not in stopwords]
result = ''.join(resultwords)
rand = [('installing '+result)]
speekmodule.speek(rand,n,mixer)
os.system('python -m pip install ' + result)
if ('music') in message:
mus = random.choice(glob.glob(doss + "\\music" + "\\*.mp3"))
os.system('chown -R user-id:group-id mus')
os.system('start ' + mus)
rand = ['start playing']
speekmodule.speek(rand,n,mixer)
# exceptions
except sr.UnknownValueError:
print("$could not understand audio")
except sr.RequestError as e:
print("Could not request results$; {0}".format(e))
IP INVESTIGATORY
PROJECTON JARVIS AI SMART DESKTOP
#JARVIS PROGRAM 2
import pyttsx3
import webbrowser
import smtplib
import random
import speech_recognition as sr
import wikipedia
import datetime
import wolframalpha
import os
import sys
engine = pyttsx3.init('sapi5')
client = wolframalpha.Client('QAEXLK-RY9HY2PHAT')
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[len(voices)-1].id)
def speak(audio):
print('Computer: ' + audio)
IP INVESTIGATORY
PROJECTON JARVIS AI SMART DESKTOP
engine.say(audio)
engine.runAndWait()
def greetMe():
currentH = int(datetime.datetime.now().hour)
if currentH >= 0 and currentH < 12:
speak('Good Morning!')
greetMe()
def myCommand():
r = sr.Recognizer()
with sr.Microphone() as source:
print("Listening...")
r.pause_threshold = 1
audio = r.listen(source)
try:
IP INVESTIGATORY
PROJECTON JARVIS AI SMART DESKTOP
query = r.recognize_google(audio, language='en-in')
print('User: ' + query + '\n')
except sr.UnknownValueError:
speak('Sorry aditya! I didn\'t get that! Try typing the command!')
query = str(input('Command: '))
return query
if __name__ == '__main__':
while True:
query = myCommand();
query = query.lower()
except:
speak('Sorry aditya! I am unable to send your message at this moment!')
else:
query = query
speak('Searching...')
try:
try:
res = client.query(query)
results = next(res.results).text
speak('WOLFRAM-ALPHA says - ')
IP INVESTIGATORY
PROJECTON JARVIS AI SMART DESKTOP
speak('Got it.')
speak(results)
except:
results = wikipedia.summary(query, sentences=2)
speak('Got it.')
speak('WIKIPEDIA says - ')
speak(results)
except:
webbrowser.open('www.google.com')