Coroutines Quiz Answer

def searcher():

    import time

    book = "aryan mansi rushikesh sarvesh siddhi vedant vidhan"


    # book = open("coroutines.txt")

    # content = book.read()

    time.sleep(1)


    while True:

        text = (yield)

        if text in book:

            print("Your text is in the book")

        else:

            print("Text is not in the book")


search = searcher()

print("Search started")

next(search)

print("Next method wil run now ")

search.send("aryan")


Comments

Popular posts from this blog

Practice Execise 3

Pickle Module