Skip to content

Instantly share code, notes, and snippets.

@xuyuji9000
Created December 23, 2017 04:34
Show Gist options
  • Save xuyuji9000/948c48ee91bfb2d5fb61bc4d07b50393 to your computer and use it in GitHub Desktop.
Save xuyuji9000/948c48ee91bfb2d5fb61bc4d07b50393 to your computer and use it in GitHub Desktop.
def coroutine(text):
while True:
input_search = (yield)
if input_search in text:
print 'contained'
else:
print('no')
@xuyuji9000
Copy link
Author

import coroutine from coroutine

t = coroutine('hello world')
t.next()
t.send('test')
t.send('hello')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment