

We are using the try and except block to handle any possible error that can occur while sending emails. Speak ( "Email has been sent!" ) except Exception as e : print (e ) Now, we will create a sendEmail() function, which will help us to send emails to one or more than one recipients.

To send an email, we need to import a module called smtplib. Here, I am saving the target into a variable called codePath, and then we are using the os module to open the application.

Step 3: Copy the target from the target section.Īfter copying the target of the application, save the target into a variable. Step 2: Right-click on the application and click on properties. Steps to get the code path of the application: To open the VS Code or any other application, we need the code path of the application. It is an in-built module, and we do not need to install it with pip statement, we can directly import it into our program by writing an import statement.ĬodePath = "C:\\Users\\spyboy\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe" To open any website, we need to import a module called webbrowser. – Defining Task 2: To open YouTube site in a web-browser If Wikipedia is found in the user’s search query, then two sentences from the summary of the Wikipedia page will be converted to speech with the help of speak function.

In the above code, we have used an if statement to check whether Wikipedia is in the search query of the user or not. Speak ( "According to Wikipedia" ) print (results ) lower ( ) #Converting user query into lower case # Logic for executing tasks based on query if 'wikipedia' in query : #if wikipedia found in the query then this block will be executed
