-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoker.py
More file actions
43 lines (35 loc) · 940 Bytes
/
Copy pathPoker.py
File metadata and controls
43 lines (35 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# -*- coding: utf-8 -*-
"""
Created on Thu May 24 20:53:44 2018
@author: suraj
"""
#Generating Pascal traingle for practice
lst = [1]
for i in range(10):
print(lst)
newlst = [lst[0]]
for i in range(len(lst)-1):
newlst.append(lst[i]+lst[i+1])
newlst.append(lst[-1])
lst = list(newlst)
#Let's play Poker
###### Poker - Cards
suits = ['\u2660','\u2665','\u2666','\u2663'] #unicodes for suits
cards = ['A','2','3','4','5','6','7','8','9',\
'10','J','Q','K']
#creating a deck
deck = []
for suit in suits:
for card in cards:
deck.append(card+suit)
print(deck)
#Shuffling the cards
import random
random.seed(52)
rando = [random.random() for i in range(52)]
#for i in enumerate(rando): print (i)
rando = [i[0] for i in sorted(enumerate(rando), key=lambda x:x[1])]
shuffle = [deck[x] for x in rando]
print(shuffle)
#poker hand
hand = shuffle[0:5]