Created
April 23, 2021 10:34
-
-
Save jaklinger/bea48792a0b4c82276e63c9e8b60a15a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import pandas as pd | |
import numpy as np | |
import time | |
from functools import lru_cache | |
WINNER_TEXT = "The winner is" | |
@lru_cache() | |
def get_data(): | |
data = pd.read_excel("ProFinda Registration Drive (Responses).xlsx").to_dict(orient="records") | |
np.random.shuffle(data) | |
return iter(data) | |
def select_winner(): | |
data = get_data() | |
winner = next(data) | |
print() | |
print(WINNER_TEXT, end="\r") | |
for i in range(3): | |
time.sleep(1) | |
print(WINNER_TEXT + (i+1)*".", end="\r") | |
time.sleep(1) | |
print(WINNER_TEXT + " *** Drumroll π₯ ***\n") | |
time.sleep(2) | |
print("β π", winner['Full Name '], "... with charity ...", winner["Charity name "], "π β") | |
print() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment