Skip to content

Instantly share code, notes, and snippets.

@arocks
Created May 1, 2015 09:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arocks/a7996964c4bcee19773a to your computer and use it in GitHub Desktop.
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
# -*- 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