diff --git a/Python_Mini_Project/Game_Hangman.py b/Python_Mini_Project/Game_Hangman.py new file mode 100644 index 0000000..1f70c41 --- /dev/null +++ b/Python_Mini_Project/Game_Hangman.py @@ -0,0 +1,80 @@ +import random +# library that we use in order to choose +# on random words from a list of words + +name = input("What is your name? ") +# Here the user is asked to enter the name first + +print("Good Luck ! ", name) + +words = ['rainbow', 'computer', 'science', 'programming', + 'python', 'mathematics', 'player', 'condition', + 'reverse', 'water', 'board', 'geeks'] + +# Function will choose one random +# word from this list of words +word = random.choice(words) + + +print("Guess the characters") + +guesses = '' + +# any number of turns can be used here +turns = 12 + + +while turns > 0: + + # counts the number of times a user fails + failed = 0 + + # all characters from the input + # word taking one at a time. + for char in word: + + # comparing that character with + # the character in guesses + if char in guesses: + print(char) + + else: + print("_") + + # for every failure 1 will be + # incremented in failure + failed += 1 + + + if failed == 0: + # user will win the game if failure is 0 + # and 'You Win' will be given as output + print("You Win") + + # this print the correct word + print("The word is: ", word) + break + + # if user has input the wrong alphabet then + # it will ask user to enter another alphabet + guess = input("guess a character:") + + # every input character will be stored in guesses + guesses += guess + + # check input with the character in word + if guess not in word: + + turns -= 1 + + # if the character doesn’t match the word + # then “Wrong” will be given as output + print("Wrong") + + # this will print the number of + # turns left for the user + print("You have", + turns, 'more guesses') + + + if turns == 0: + print("You Loose") \ No newline at end of file diff --git a/Python_Mini_Project/Guess_The_Number.py b/Python_Mini_Project/Guess_The_Number.py new file mode 100644 index 0000000..9a64b3b --- /dev/null +++ b/Python_Mini_Project/Guess_The_Number.py @@ -0,0 +1,31 @@ +import random + +player_name = input("Hello There, Enter your name\n") +print(f'\nWelcome {player_name}, to the Guessing Game') +while True: + number = random.randint(1, 20) + print(f'{player_name}, I\'m thinking a number between 1 to 20.\nYou have 6 chances to guess it right, Good Luck') + + for guessTaken in range(0, 6): + print("Take a guess") + guessed_number = int(input()) + if 5 <= number - guessed_number > 0: + print("The number is too low.") + elif 5 > number - guessed_number > 0: + print("The number is a little low.") + elif 5 > guessed_number - number > 0: + print("The number is a little high.") + elif 5 <= guessed_number - number > 0: + print("The number is a too high.") + else: + break + + if number == guessed_number: + print(f'Well Done, {player_name} You guessed correct in {guessTaken} guesses') + else: + print(f'The chance is over. The number I was thinking of is {number}') + + choice = input("Do you want to play again(y/n):") + if choice != 'y': + print("Thank You for playing!!") + break diff --git a/Python_Mini_Project/guess the movie.py b/Python_Mini_Project/guess the movie.py new file mode 100644 index 0000000..3b0486e --- /dev/null +++ b/Python_Mini_Project/guess the movie.py @@ -0,0 +1,80 @@ +import random +list=["LAGAAN","ANAND","3IDIOTS","DANGAL","SWADES","AWEDNESDAY","UDAAN","SPECIAL26","SULTAN","HAIDER","QUEEN","BARFI","GURU","SARKAR","DRISHYAM","BABY","PK","AIRLIFT","HOLIDAY","GOODNEWWZ","KAHANI","BLACK","GOLMAAL","CHUPKECHUPKE","SHOLAY","DEEWAR","KESHARI","SHAHENSHAH","SHARABI","COOLIE","WAZIR","MANJHI","DON","ANDHADUN","PINK","LOOTERA","BADLA","AGNEEPATH","HUM","NEERJA","THELUNCHBOX","VEERZARA","MSDHONI","MANN","DIL","DHADKAN","ISHQ","KHILADI","ANARI","BADSHAH","BAZIGAR"] +#print(len(list)) +movie=random.choice(list) +#print(movie) +n=(len(movie)) +f=0 +k=0 +arr=[] +for i in range(0,n): + arr.append("_") + +print("The rule of the game is:") +print("You have got 7 trials to enter the movie name .") +print("If u cant guess the name, then you can simply enter a letter.") +print() +for i in range(0,n): + print(arr[i]," ",end="") +tr=1 +while(tr<=7): + print("Guess the movie if u can else enter a letter!") + inp=input() + print() + if(len(inp)==n or arr==movie): + if(inp == movie): + print("Hurray! You won. Yes the answer was",movie) + f=1 + break + else: + print("Sorry,thats not right.") + print("You still have",7-tr," turns left.Try again.") + print() + for i in range(0,n): + print(arr[i]," ",end="") + print() + inp=input() + tr=tr+1 + continue + elif(len(inp)==1): + for i in range(0,n): + c=movie[i] + if(inp==c): + arr[i]=c + k=1 + for i in range(0,n): + print(arr[i]," ",end="") + print() + if(k==1): + print("Yes ",inp," is presnt in d movie name") + print("You still have",7-tr," turns left.Try again.",end=" ") + print("Keep going") + else: + print("Sorry",inp," is not there.") + print("You still have",7-tr," turns left.Try again.") + k=0 + tr=tr+1 + continue + + print("Sorry,thats not right. Try again.") + print("You still have",7-tr," turns left.Try again.") + print() + inp=input() + tr=tr+1 + + +print() +if f!=1: + print("Sorry,the answer was",movie) + + + + + + + + + + + + \ No newline at end of file diff --git a/Python_Mini_Project/index.html b/Python_Mini_Project/index.html new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Python_Mini_Project/index.html @@ -0,0 +1 @@ + diff --git a/Python_Mini_Project/jarvis2.py b/Python_Mini_Project/jarvis2.py new file mode 100644 index 0000000..4879314 --- /dev/null +++ b/Python_Mini_Project/jarvis2.py @@ -0,0 +1,167 @@ +import pyttsx3 #pip install pyttsx3 +import speech_recognition as sr #pip install speechRecognition +import datetime +import wikipedia #pip install wikipedia +import webbrowser +import os +import smtplib +import pyautogui +import psutil + +engine = pyttsx3.init('sapi5') +voices = engine.getProperty('voices') +# print(voices[1].id) +engine.setProperty('voice', voices[0].id) + + +def speak(audio): + engine.say(audio) + engine.runAndWait() + + +def wishMe(): + hour = int(datetime.datetime.now().hour) + if hour>=0 and hour<12: + speak("Good Morning sir!") + + elif hour>=12 and hour<18: + speak("Good Afternoon sir!") + + else: + speak("Good Evening sir!") + + speak("Hello I am Jarvis. speed one terabite, cpu 12ssr4. Please tell me how may I help you") + +def takeCommand(): + #It takes microphone input from the user and returns string output + + r = sr.Recognizer() + with sr.Microphone() as source: + print("Listening...") + r.pause_threshold = 1 + audio = r.listen(source) + + try: + print("Recognizing...") + query = r.recognize_google(audio, language='en-in') + print(f"User said: {query}\n") + + except Exception as e: + # print(e) + print("Say that again please...") + return "None" + return query + +def sendEmail(to, content): + server = smtplib.SMTP('smtp.gmail.com', 587) + server.ehlo() + server.starttls() + server.login('youremail@gmail.com', 'your-password') + server.sendmail('youremail@gmail.com', to, content) + server.close() + +def screenshot(): + img = pyautogui.screenshot() + img.save("C:\\Users\\Aritro chakraborty\\Desktop\\ss.png") + +def cpu(): + usage = str(psutil.cpu_percent()) + speak('cpu is usage at' + usage +"GB") +def battery(): + battery = psutil.sensors_battery() + speak("Battery is percentage is") + speak(battery.percent) + +if __name__ == "__main__": + wishMe() + while True: + # if 1: + query = takeCommand().lower() + + # Logic for executing tasks based on query + if 'wikipedia' in query: + speak('Searching Wikipedia...') + query = query.replace("wikipedia", "") + results = wikipedia.summary(query, sentences=2) + speak("According to Wikipedia") + print(results) + speak(results) + + elif 'open youtube' in query: + webbrowser.open("youtube.com") + + # elif 'open google' in query: + # speak('what should i search..!') + # edge ='C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe %s' + # search = takeCommand().lower() + # webbrowser.get(edge).open_new_tab(search+'.com') + + elif 'open google' in query: + webbrowser.open("google.com") + + elif 'open stack overflow' in query: + webbrowser.open("stack overflow.com") + + elif 'remember that' in query: + speak("What shpuld i remember ? ") + data = takeCommand() + speak("you said me to remember that"+data) + remember = open('data.txt','w') + remember.write(data) + remember.close() + + elif 'do you know anything' in query: + remember = open('data.txt','r') + speak("you said me to remember that" +remember.read()) + + elif 'play music' in query: + music_dir = 'D:\\Favorite Songs2' + songs = os.listdir(music_dir) + print(songs) + os.startfile(os.path.join(music_dir, songs[0])) + + elif "cpu" in query: + cpu() + + elif "battery" in query: + battery() + + elif 'time' in query: + strTime = datetime.datetime.now().strftime("%H:%M:%S") + speak(f"Sir, the time is {strTime}") + + elif 'thank you' in query: + speak("it's my pleasure sir..") + + elif 'screenshot' in query: + speak("taking ..") + screenshot() + speak("it's done sir ! please check it in desktop..") + + elif 'open code' in query: + codePath = 'C:\\Users\\Aritro chakraborty\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe' + os.startfile(codePath) + + elif 'date' in query: + year = int(datetime.datetime.now().year) + month = int(datetime.datetime.now().month) + date = int(datetime.datetime.now().day) + speak("Today is") + speak(date) + speak(month) + speak(year) + + elif 'offline' in query: + speak("going to offline.. i was happy to help you..") + quit() + + elif 'email' in query: + try: + speak("What should I say?") + content = takeCommand() + to = "harryyourEmail@gmail.com" + sendEmail(to, content) + speak("Email has been sent!") + except Exception as e: + print(e) + speak("i am extremly Sorry sir. I am not able to send this email") diff --git a/Python_Mini_Project/jokes-desktop-notifier.py b/Python_Mini_Project/jokes-desktop-notifier.py new file mode 100644 index 0000000..44cf19b --- /dev/null +++ b/Python_Mini_Project/jokes-desktop-notifier.py @@ -0,0 +1,8 @@ +import pyjokes +import time +from win10toast import ToastNotifier + +while 1: + notify = ToastNotifier() + notify.show_toast("Time to laugh!", pyjokes.get_joke(), duration = 20) + time.sleep(1800) diff --git a/Python_Mini_Project/source-code-color.py b/Python_Mini_Project/source-code-color.py new file mode 100644 index 0000000..c648b79 --- /dev/null +++ b/Python_Mini_Project/source-code-color.py @@ -0,0 +1,18 @@ +from colorama import init +init() +from colorama import Fore , Back , Style # Fore- font color | Back- Background + +print(Fore.GREEN,"hello qxresearcher") + +print(Back.RED,"hello qxresearcher") + +#to get back to boring B&W: print(Styoe.RESET_ALL) + +``` +All Variaton on Colors: + +Fore: BLACK RED GREEN YELLOW BLUE MAGENTA CYAN WHITE RESET +Back: BLACK RED GREEN YELLOW BLUE MAGENTA CYAN WHITE RESET +Style: DIM NORMAL BRIGHT RESET_ALL + +``` diff --git a/Python_Mini_Project/source-code-custom.py b/Python_Mini_Project/source-code-custom.py new file mode 100644 index 0000000..31e0e35 --- /dev/null +++ b/Python_Mini_Project/source-code-custom.py @@ -0,0 +1,3 @@ +import win10toast +toaster = win10toast.ToastNotifier() +toaster.show_toast("python","success ! This is working!", duration=10) diff --git a/Python_Mini_Project/source-code-funky.py b/Python_Mini_Project/source-code-funky.py new file mode 100644 index 0000000..dce6f78 --- /dev/null +++ b/Python_Mini_Project/source-code-funky.py @@ -0,0 +1,16 @@ +import pyfiglet +word = pyfiglet.figlet_format("qxresearch",font="alphabet") +print(word) + +``` +Output: + h + h + qqq x x rrr eee ss eee aa rrr ccc hhh +q q x r e e s e e a a r c h h + qqq x x r ee ss ee aaa r ccc h h + q + qq + + +``` diff --git a/Python_Mini_Project/source-code-timer.py b/Python_Mini_Project/source-code-timer.py new file mode 100644 index 0000000..4f4cb83 --- /dev/null +++ b/Python_Mini_Project/source-code-timer.py @@ -0,0 +1,11 @@ +from win10toast import ToastNotifier +import time +while True: + current_time = time.strftime("%H:%M:%S") + if current_time=="00.36.00": + print(current_time) + break + else: + pass +hr=ToastNotifier() +hr.show_toast("alarm","this is the message") diff --git a/Python_Mini_Project/source-code.py b/Python_Mini_Project/source-code.py new file mode 100644 index 0000000..01ef31c --- /dev/null +++ b/Python_Mini_Project/source-code.py @@ -0,0 +1,9 @@ +import sounddevice +from scipy.io.wavfile import write +fs=44100 #sample_rate +second=int(input("Enter the time duration in second: ")) #enter your required time.. +print("Recording....\n") +record_voice=sounddevice.rec(int(second * fs),samplerate=fs,channels=2) +sounddevice.wait() +print("Finished...\nPlease Check it...") +write("out.wav",fs,record_voice) \ No newline at end of file