#!/usr/bin/env python3 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. def main(): print(" Keeps track of deals per user", "Hit 'enter' to print next deal", "Use ^C or ^D to exit", sep="\n ") number = get_int("Number of players", 2) users = add_players("Name", number) deal = get_int("Deals per turn", number) + 1 while True: try: for x in range(len(users)): for b in range(1, deal): print(users[x], "-", b) input() except (EOFError, KeyboardInterrupt): break def add_players(msg, number): msg += "? " players = [] for x in range(number): line = input(msg) players.append(line) return players def get_int(msg, default=None): msg += "? " if default is None else " [{0}]? ".format(default) while True: line = input(msg) try: if line: i = int(line) else: i = int(default) except ValueError as err: print(err) continue return i if __name__ == "__main__": main()