Source code for python programs

How to Setup app-ads.txt file in admob

Image
  AdMob provides a personalized code snippet that makes setting up your app-ads.txt file easier. The customized code snippet includes your publisher ID.  Note that your  publisher ID  must be included and formatted correctly for your app-ads.txt file to be verified.  To get your personalized code snippet, which includes your publisher ID: Sign in to your AdMob account at  https://apps.admob.com . Click  Apps  in the sidebar. Click  All apps . Click the  app-ads.txt  tab. Click  How to set up app-ads.txt .  Click next to the code snippet to copy.  Paste the code snippet into your app-ads.txt file. 

Make your own Jarvis in python

 

Make your own jarvis program: here i give a code for jarvis you can copy or paste the program

and use it 

 

//First import all libraries 

import pyttsx3

import webbrowser

import smtplib

import random

import speech_recognition as sr

import wikipedia

import datetime

# import wolframalpha

import os

import sys

 

// here instiallize the engine object

engine = pyttsx3.init('sapi5')

voices = engine.getProperty('voices')

engine.setProperty('voice', voices[len(voices) - 1].id)

 

// create speak function

 

def speak(audio):

    print('Computer: ' + audio)

    engine.say(audio)

    engine.runAndWait()

 

// create greet function that will greet your user according the time

def greetMe():

    currentH = int(datetime.datetime.now().hour)

    if currentH >= 0 and currentH < 12:

        speak('Good Morning!')

 

    if currentH >= 12 and currentH < 18:

        speak('Good Afternoon!')

 

    if currentH >= 18 and currentH != 0:

        speak('Good Evening!')

 

 

greetMe()

 

speak('Hello Sir, I am your digital assistant Chhaayaa!')

speak('How may I help you?')

 

 

def myCommand():

    r = sr.Recognizer()

    with sr.Microphone() as source:

        print("Listening...")

        r.pause_threshold = 1

        audio = r.listen(source)

    try:

        query = r.recognize_google(audio, language='en-in')

        print('User: ' + query + '\n')

 

    except sr.UnknownValueError:

        speak('Sorry sir! 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()

 

        if 'open youtube' in query:

            speak('okay')

            webbrowser.open('www.youtube.com')

 

        elif 'open google' in query:

            speak('okay')

            webbrowser.open('www.google.co.in')

 

        elif 'play music' in query:

            music_dir = 'D:\\music'

            songs = os.listdir(music_dir)

            os.startfile(os.path.join(music_dir, songs[1]))

            speak('Here,s your song sir Enjoy')

 

        elif 'open gmail' in query:

            speak('okay')

            webbrowser.open('www.gmail.com')

 

 

        elif "what\'s up" in query or 'how are you' in query:

            stMsgs = ['Just doing my thing!', 'I am fine!', 'Nice!', 'I am nice and full of energy']

            speak(random.choice(stMsgs))

 

        elif 'nothing' in query or 'abort' in query or 'stop' in query:

            speak('okay')

            speak('Bye Sir, have a good day.')

            sys.exit()

 

        elif 'hello' in query:

            f = open("C:\\Users\\DELL\\Desktop\\pythonexamples\\ready.txt", "r")

            speak(f.read())

 

        elif 'bob' in query:

            speak(query)

 

 

 

        elif 'bye' in query:

            speak('Bye Sir, have a good day.')

            sys.exit()

 

 

        else:

            query = query

            speak('Searching...')

            try:

                try:

                    res = client.query(query)

                    results = next(res.results).text

                    speak('Mohit says - ')

                    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')

 

        speak('Next Command! Sir!')

Comments

Popular posts from this blog

Currency converter code for android studio

Login Python Source code