├── README.md ├── fibonacci generator python.py └── voice-assistant.py /README.md: -------------------------------------------------------------------------------- 1 | # CodeAlpha Internship Task as Python Developer 2 | 3 | 4 | ## Language are used: 5 | - Python 6 | 7 | 8 | ## Tools used in the Page 9 | 10 | - [VS Code](https://code.visualstudio.com/) as the editor 11 | - [Pycharm](https://www.jetbrains.com/pycharm/) as the editor 12 | 13 | ## Task-1 14 | **FIBONACCI GENERATOR** 15 | 16 | The Fibonacci series is a sequence where each number is 17 | the sum of the two preceding numbers, defined by a 18 | mathematical recurrence relationship. 19 | 20 | - [Task-1](https://github.com/DS-Popeye/CodeAlpha_Internship_Task/blob/main/fibonacci%20generator%20python.py) 21 | 22 | 23 | ## Task-2 24 | **VOICE ASSISTANT** 25 | 26 | Create a custom voice assistant using Python to 27 | personalize and automate tasks according to your 28 | needs. Python's versatility makes it an excellent choice 29 | for scripting and development, allowing you to build a 30 | voice assistant that can compete with the likes of Siri, 31 | Alexa, and Google Assistant. 32 | 33 | - [Task-2](https://github.com/DS-Popeye/CodeAlpha_Internship_Task/blob/main/voice-assistant.py) -------------------------------------------------------------------------------- /fibonacci generator python.py: -------------------------------------------------------------------------------- 1 | n = 10 2 | num1 = 0 3 | num2 = 1 4 | next_number = num2 5 | count = 1 6 | 7 | while count <= n: 8 | print(next_number, end=" ") 9 | count += 1 10 | num1, num2 = num2, next_number 11 | next_number = num1 + num2 12 | print() -------------------------------------------------------------------------------- /voice-assistant.py: -------------------------------------------------------------------------------- 1 | import speech_recognition as sr 2 | import pyttsx3 3 | import webbrowser 4 | 5 | # initializing the speech recognizer and engine 6 | recognizer = sr.Recognizer() 7 | engine = pyttsx3.init() 8 | 9 | # Define commands and actions 10 | commands = { 11 | "open google": lambda: webbrowser.open("https://www.google.com"), 12 | "open facebook": lambda: webbrowser.open("https://www.facebook.com"), 13 | "tell me a joke": lambda: engine.say("Why did the bullet end up losing his job? He got fired!"), 14 | "stop listening": lambda: exit(), 15 | } 16 | 17 | # this function is to process voice commands 18 | def process(command): 19 | action = commands.get(command.lower()) 20 | if action: 21 | action() 22 | else: 23 | engine.say("Sorry, I didn't understand that command.") 24 | engine.runAndWait() 25 | 26 | # waiting for input frm user to start 27 | input("Press any key to start listening...") 28 | 29 | # Main loop to listen for commands 30 | while True: 31 | with sr.Microphone() as source: 32 | print("Listening...") 33 | audio = recognizer.listen(source) 34 | 35 | try: 36 | print("Recognizing...") 37 | command = recognizer.recognize_google(audio) 38 | print(f"Command: {command}") 39 | process(command) 40 | except sr.UnknownValueError: 41 | print("Sorry, I couldn't understand what you said.") 42 | except sr.RequestError: 43 | print("There was an error with the speech recognition service.") --------------------------------------------------------------------------------