#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Aug 30 15:28:46 2019 @author: neilcotter """ import numpy as np first_hand_str = str(input('input the first 3-card hand up cards as, e.g., \'3B 2Y\'.\n')) # User must put input inside single quotes print 'first_hand_str = ' + first_hand_str second_hand_str = str(input('input the second 3-card hand up card as, e.g., \'5R\'.\n')) print 'second_hand__str = ' + second_hand_str # Translate card # and suite letter into card number from 1 to 20 first_hand_cards = first_hand_str.split() # Splits string into list of words print(first_hand_cards) for card_index in range(0,2): # Ending index must 1+desired last index value. print 'first hand card = ' + first_hand_cards[card_index] suit = first_hand_cards[card_index][1] print 'suit = ' + suit # extract suit and convert to # if suit == 'B': suitnum = 0 elif suit == 'G': suitnum = 1 elif suit == 'R': suitnum = 2 elif suit == 'Y': suitnum = 3 else: print 'error: suit = ' + suit + 'not B, G, R, or Y' print(suitnum) card_num_str = first_hand_cards[card_index][0] print 'card_num_str = ' + card_num_str # val card_num = card_num_str.map(Character::getNumericValue) card_num = ord(card_num_str) - 48 print 'card_num =', repr(card_num) #if x == 'B' print 2 # Create list of 20 cards cards = np.r_[1:20.1:1] # Sequence of values in cards is [start,stop-1,step] # Card # is suit*5 + number on card # Calculate # Remove