Created
May 1, 2015 09:32
-
-
Save arocks/a7996964c4bcee19773a to your computer and use it in GitHub Desktop.
Randomly pick a twitter username n times and show the last picked as winner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" raffle - Randomly pick a twitter username n times and show the last picked as winner""" | |
import random, time | |
TIMES = 20 | |
entries = """ | |
https://twitter.com/username1 | |
https://twitter.com/username2 | |
https://twitter.com/username3 | |
https://twitter.com/username4 | |
https://twitter.com/username5 | |
""".strip().split() | |
entries = [e.replace("https://twitter.com/", "") for e in entries] | |
for i in range(TIMES): | |
pick = random.choice(entries) | |
print("{:>30}".format(pick),end='\r') | |
time.sleep(.1) | |
print("Today's winner is: @{}, congratulations!!!".format(pick)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment