Skip to content

Commit d20ccd1

Browse files
authored
Merge pull request #120 from PdxCodeGuild/kelin-lab04-blackjack-advice
Kelin lab04 blackjack advice
2 parents e25397e + dd28a5f commit d20ccd1

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

code/kelin/labs/lab04_blackjack_advice.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
1+
# Kelin Ray
12
# Lab 4: Blackjack Advice
23

34
# Let's write a python program to give basic blackjack playing advice during a game by asking the player for cards.
45
# First, ask the user for three playing cards (A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, or K).
56
# Then, figure out the point value of each card individually. Number cards are worth their number, all face cards are worth 10.
67
# At this point, assume aces are worth 1. Use the following rules to determine the advice:
8+
"""Add user input 3 cards, 1 deck, and Give advice based on those cards"""
79

8-
deck_one = ['A','2','3','4','5','6','7','8','9','10','J','Q','K','A','2','3','4','5','6','7','8','9','10','J','Q','K','A','2','3','4','5','6','7','8','9','10','J','Q','K','A','2','3','4','5','6','7','8','9','10','J','Q','K']
9-
deck_two = ['A','2','3','4','5','6','7','8','9','10','J','Q','K','A','2','3','4','5','6','7','8','9','10','J','Q','K','A','2','3','4','5','6','7','8','9','10','J','Q','K','A','2','3','4','5','6','7','8','9','10','J','Q','K']
10-
deck_three = ['A','2','3','4','5','6','7','8','9','10','J','Q','K','A','2','3','4','5','6','7','8','9','10','J','Q','K','A','2','3','4','5','6','7','8','9','10','J','Q','K','A','2','3','4','5','6','7','8','9','10','J','Q','K']
10+
print(f"Welcome to Blackjack Advice.")
1111

12-
import random
12+
first_card = input("Enter first card (A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, or K): ")
13+
second_card = input("Enter second card (A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, or K): ")
14+
third_card = input("Enter third card (A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, or K): ")
1315

14-
random.shuffle(deck_one)
15-
random.shuffle(deck_two)
16-
random.shuffle(deck_three)
16+
# Deleted the random cards and now take 3 inputs for cards from the user to give advice.
1717

18-
first_card = random.choice(deck_one)
19-
second_card = random.choice(deck_two)
20-
third_card = random.choice(deck_three)
21-
22-
print(f"Welcome to Blackjack.","Your cards are:",first_card,second_card,third_card)
18+
print(f"Your cards are:",first_card,second_card,third_card)
2319

2420
if first_card == 'A':
2521
first_card = int('1')
@@ -68,3 +64,4 @@
6864
# Aces can be worth 11 if they won't put the total point value of both cards over 21. Remember that you can have multiple aces in a hand.
6965
# Try generating a list of all possible hand values by doubling the number of values in the output whenever you encounter an ace.
7066
# For one half, add 1, for the other, add 11. This ensures if you have multiple aces that you account for the full range of possible values.
67+

0 commit comments

Comments
 (0)