Private Proxies – Buy Cheap Private Elite USA Proxy + 50% Discount!Private Proxies – Buy Cheap Private Elite USA Proxy + 50% Discount!Private Proxies – Buy Cheap Private Elite USA Proxy + 50% Discount!Private Proxies – Buy Cheap Private Elite USA Proxy + 50% Discount!
    0
  •   was successfully added to your cart.
  • Home
  • Buy proxies
  • Extra features
  • Help
  • Contact
  • Login
  • 50% OFF
    BUY NOW!
    50
    PROXIES
    $19
    --------------------
    BUY NOW!
    BUY NOW!
    BUY NOW!
    BUY NOW!
    BUY NOW!
    $29
    $49
    $109
    $179
    $299
    --------------------
    --------------------
    --------------------
    --------------------
    --------------------
    PROXIES
    PROXIES
    PROXIES
    PROXIES
    PROXIES
    100
    200
    500
    1,000
    2,000
    TOP SELLER
    BEST VALUE
    For All Private Proxies!

I am attempting to write a game of blackjack using classes in Python. Any advice on keeping it DRY? I seem to be creating too many lists in lists. Should I name the keys in the dictionary or just use integers?

import random import itertools as it  number_players = 2 #input('Enter Number of Players here: ') number_cards = 2 #input('Enter Number of Cards here: ')  # create the deck of cards deck = list(it.product("♠♣♥♦", [str(x) for x in range(2, 11)] + list("JQKA"))) random.shuffle(deck)  # print(len(deck)) # print(deck)  # init the memo memo = set()   def set_shuffle(n):     for i in range(n):         k = random.choice(deck)         if k not in memo:             memo.add(k)         else:             set_shuffle(1)     return memo #sorted(memo)  i = set_shuffle(52)  def deal(deck, number_players, number_cards):     """          Deals n amount of cards to n amount of players.     """      player_dict = {'Player' + str(k + 1): [i.pop() for x in range(number_cards)] for k in range(number_players)}      dealer_hand = [i.pop() for x in range(number_cards)]     player_dict['Dealer'] = dealer_hand      return player_dict  players = deal(deck, number_players, number_cards)  def print_current_cards(player_dict):     """ pretty prints the current hands """     for k, v in player_dict.items():         print('{} hand:'.format(k))         for u in v:             print(u[1], u[0])         print('\n') print_current_cards(players)  class Player:     """Takes in a players cards for processing"""      def __init__(self, cards, player):         self.cards = cards         self.player = player      def pic_to_int(self, card):         """takes in a card and converts it to an integer of 10 for JQK or 10 and 11 for A """          card_list = ['J', 'Q', 'K', '10']          if card in card_list:             return 10         elif card == 'A':             return 11         if card not in card_list and card != 'A':             return int(card)      def current_score(self):         """ Evaluates the current list of cards and returns a total integer value"""         total = 0          if self.is_blackjack() == True:             return         else:             for c in self.cards:                 for c1 in c:                     for c2 in c1[1:]:                         if c2.isdigit():                             total += int(c2)                          elif 'A' == c2:                             total += 11                         else:                             total += 10         print('Current card total: ', total, '\n')         return total      def is_blackjack(self):         """ Takes in 2 cards and returns True if the cards contain only 1x Ace and either 10, J, Q or K         """         if len(self.cards[0]) == 2:             c1 = self.pic_to_int(self.cards[0][0][1])             c2 = self.pic_to_int(self.cards[0][1][1])             total = c1 + c2 if c1 or c2 else 0              if total == 21:                 print('BLACKJACK!!!!')                 return              else:                 return False         else:             return False      def check_if_bust(self):         score = self.current_score()         bust = False         if score > 21:             bust = True             print("Bust!")             return bust         return bust      def stick_or_twist(self, twist=False):         """ Takes in current hand and processes a new card             returns ok or bust         """         score = self.current_score()         cards = self.cards         if self.player == 'Dealer':             if score < 17:                 cards[0].append(i.pop())                 self.check_if_bust()             else:                 print('Dealer must stand on 17')          elif self.player != 'Dealer':             cards[0].append(i.pop())             self.check_if_bust()      def split_pair(self):         """ splits a pair of the same cards into 2 games """         pass   player1 = Player([v for k, v in players.items() if 'Player1' == k], 'Player1') player2 = Player([v for k, v in players.items() if 'Player2' == k], 'Player2') dealer = Player([v for k, v in players.items() if 'Dealer' == k], 'Dealer')  player_list = [player1, player2, dealer]  for p in player_list:     print(p.player, ':')     p.is_blackjack()     p.current_score()     p.check_if_bust()     p.stick_or_twist(twist=True)  print(len(i), 'cards left') print_current_cards(players)   # for x in range(3):  #     j = i.pop() #     print(j)  # print(len(i), 'cards left') 

✓ Extra quality

ExtraProxies brings the best proxy quality for you with our private and reliable proxies

✓ Extra anonymity

Top level of anonymity and 100% safe proxies – this is what you get with every proxy package

✓ Extra speed

1,ooo mb/s proxy servers speed – we are way better than others – just enjoy our proxies!

50 proxies

$19/month

50% DISCOUNT!
$0.38 per proxy
✓ Private
✓ Elite
✓ Anonymous
Buy now

100 proxies

$29/month

50% DISCOUNT!
$0.29 per proxy
✓ Private
✓ Elite
✓ Anonymous
Buy now

200 proxies

$49/month

50% DISCOUNT!
$0.25 per proxy
✓ Private
✓ Elite
✓ Anonymous
Buy now

500 proxies

$109/month

50% DISCOUNT!
$0.22 per proxy
✓ Private
✓ Elite
✓ Anonymous
Buy now

1,000 proxies

$179/month

50% DISCOUNT!
$0.18 per proxy
✓ Private
✓ Elite
✓ Anonymous
Buy now

2,000 proxies

$299/month

50% DISCOUNT!
$0.15 per proxy
✓ Private
✓ Elite
✓ Anonymous
Buy now

USA proxy location

We offer premium quality USA private proxies – the most essential proxies you can ever want from USA

100% anonymous

Our proxies have TOP level of anonymity + Elite quality, so you are always safe and secure with your proxies

Unlimited bandwidth

Use your proxies as much as you want – we have no limits for data transfer and bandwidth, unlimited usage!

Superfast speed

Superb fast proxy servers with 1,000 mb/s speed – sit back and enjoy your lightning fast private proxies!

99,9% servers uptime

Alive and working proxies all the time – we are taking care of our servers so you can use them without any problems

No usage restrictions

You have freedom to use your proxies with every software, browser or website you want without restrictions

Perfect for SEO

We are 100% friendly with all SEO tasks as well as internet marketing – feel the power with our proxies

Big discounts

Buy more proxies and get better price – we offer various proxy packages with great deals and discounts

Premium support

We are working 24/7 to bring the best proxy experience for you – we are glad to help and assist you!

Satisfaction guarantee

24/7 premium support, free proxy activation and 100% safe payments! Best reliability private proxies for your needs!

Best Proxy Packs

  • 2,000 Private Proxies $600.00 $299.00 / month
  • 1,000 Private Proxies $360.00 $179.00 / month

Quick Links

  • More information
  • Contact us
  • Privacy Policy
  • Terms and Conditions

Like And Follow Us


Copyright ExtraProxies.com | All Rights Reserved.
  • Checkout
  • Contact
  • Help
  • Home
  • My Account
  • My Cart
  • News
  • Privacy Policy
  • Proxy features
  • Proxy packs
  • Terms and Conditions
Private Proxies – Buy Cheap Private Elite USA Proxy + 50% Discount!
    0 items