|
| 1 | +# Kelin Ray |
1 | 2 | # Lab 4: Blackjack Advice
|
2 | 3 |
|
3 | 4 | # Let's write a python program to give basic blackjack playing advice during a game by asking the player for cards.
|
|
6 | 7 | # At this point, assume aces are worth 1. Use the following rules to determine the advice:
|
7 | 8 | """Add user input 3 cards, 1 deck, and Give advice based on those cards"""
|
8 | 9 |
|
9 |
| -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'] |
10 |
| -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'] |
11 |
| -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.") |
12 | 11 |
|
13 |
| -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): ") |
14 | 15 |
|
15 |
| -random.shuffle(deck_one) |
16 |
| -random.shuffle(deck_two) |
17 |
| -random.shuffle(deck_three) |
| 16 | +# Deleted the random cards and now take 3 inputs for cards from the user to give advice. |
18 | 17 |
|
19 |
| -first_card = random.choice(deck_one) |
20 |
| -second_card = random.choice(deck_two) |
21 |
| -third_card = random.choice(deck_three) |
22 |
| - |
23 |
| -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) |
24 | 19 |
|
25 | 20 | if first_card == 'A':
|
26 | 21 | first_card = int('1')
|
|
0 commit comments