Automatically Reply to Tweets
Make a service that automatically replies to tweets asking if numbers are prime.
Initialize a value to keep track of the latest processed tweet.
Send a tweet with the hashtag #IsItPrime for testing.
Out[2]= | |
Create a function that extracts integers from a tweet and determines if they are prime.
Create a function that constructs a reply to an #IsItPrime tweet.
Put the pieces together in a function that collects, analyzes, and responds to tweets.
Test the function on any tweets with the #IsItPrime hashtag, including your own.
Out[8]= | |
Run the function in a scheduled task that wakes up to process tweets every two minutes.
Out[9]= | |