Skip to content

Instantly share code, notes, and snippets.

@ChristopherBilg
Created March 13, 2018 14:27
Show Gist options
  • Save ChristopherBilg/04b6d00375dfdf0ab963e0661c7cd061 to your computer and use it in GitHub Desktop.
Save ChristopherBilg/04b6d00375dfdf0ab963e0661c7cd061 to your computer and use it in GitHub Desktop.
r/DailyProgrammer Kids Lotto
Rebbeca Gann;Latosha Caraveo;Jim Bench;Carmelina Biles;Oda Wilhite;Arletha Eason;Theresa Kaczorowski;Jane Cover;Melissa Wise;Jaime Plascencia;Sacha Pontes;Tarah Mccubbin;Pei Rall;Dixie Rosenblatt;Rosana Tavera;Ethyl Kingsley;Lesia Westray;Vina Goodpasture;Drema Radke;Grace Merritt;Lashay Mendenhall;Magali Samms;Tiffaney Thiry;Rikki Buckelew;Iris Tait;Janette Huskins;Donovan Tabor;Jeremy Montilla;Sena Sapien;Jennell Stiefel;15
#!usr/bin/env python3
"""
This script is the r/DailyProgrammer Easy Challenge #310 titles
Kids Lotto.
"""
import random
def main():
"""
Function that handles the actual code that will be run.
"""
with open("kids.txt", "r") as kids:
line = kids.read()
output_list_num = int(line.split(";")[-1])
all_kids = line.split(";")[:-1]
for kid in all_kids:
choices = []
while len(choices) < output_list_num:
choice = random.choice(all_kids)
if not ((choice == kid) or (choice in choices)):
choices.append(choice)
print(kid + " > " + ", ".join(choices))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment