[PYTHON] A program to elect a president based on prestigious democracy from ATND participants

A program that decides the president from ATND participants. Please download the ATND Participant CSV and use it as appropriate.

Use scene

It is used when delivering food at ATND to avoid the situation of sushi, pizza, curry, etc.

Puriketsu democracy

The decision-maker is randomly determined based on the vote. That is the president. Assuming an infinite number of trials, democracy is more likely to reflect the will of the voters than majority democracy. The motif is the rule of the Phantom Troupe, "The law of the members is serious. If you fight, you will decide with coins."

meshi.py


#!/usr/bin/python
# coding: UTF-8
 
import csv
import random
filename = "entry.csv"
csvfile = open(filename)
 
list = []
for row in csv.reader(csvfile):
  if row[0] != "name":
    list.append(row[0])
csvfile.close()
print random.sample(list,1)[0]

Recommended Posts

A program to elect a president based on prestigious democracy from ATND participants
Simple code to call a python program from Javascript on EC2
From buying a computer to running a program with python
Use bubble sort to generate random numbers based on a standard normal distribution from uniform random numbers
How to run a Python program from within a shell script
How to make a .dylib library from a .a library on OSX (El Capitan)
Everything from building a Python environment to running it on Windows