Skip to content

Commit 56ff2f2

Browse files
pranasziaukasBethanyG
authored andcommitted
Supply hints
1 parent 14ebab7 commit 56ff2f2

File tree

1 file changed

+23
-11
lines changed
  • exercises/concept/black-jack/.docs

1 file changed

+23
-11
lines changed
Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
11
# General
22

3-
- [The Python Comparisons Tutorial][the python comparisons tutorial] and [Python comparisons examples][python comparisons examples] can be a great introduction.
3+
[The Python comparisons tutorial][python comparisons tutorial] and [Python comparisons examples][python comparisons examples] are a great introduction covering the content of this exercise.
44

5-
## 1. Calculate the number of card
5+
## 1. Calculate the value of a card
66

7-
- You can use the [equality comparison operator][equality comparison operator] to get the number of the card.
7+
- You can use the equality comparison operator `==` to determine specific cards, e.g. `card == 'J'`.
8+
- You can use the [`int` constructor][int constructor] to get an integer number from an integer literal, e.g. `int(card)`.
89

9-
## 2. Calculate the number of Ace
10+
## 2. Calculate the value of an ace
1011

11-
- You can use the [order comparisons operator][order comparisons operator]to decide the value of ace without the sum of hand exceeding 21.
12+
- You can use the order comparison operator `>` to decide the appropriate course of action, e.g. `hand_value + 11 > 21`.
1213

13-
## 3. Judge Blackjack
14+
## 3. Determine Blackjack
1415

15-
- You can use the [membership test operations][membership test operations] in `if` or `elif` syntax to find black-jack from the first two cards in your hand.
16+
- You can use the [`if`/`elif`/`else` syntax][if syntax] to handle different combinations of cards.
17+
- You can reuse the already implemented `value_of_card` function.
1618

17-
[the python comparisons tutorial]: https://docs.python.org/3/reference/expressions.html#comparisons
19+
## 4. Splitting pairs
20+
21+
- You can handle the `A` case (when at least one of the cards in an ace) separately.
22+
23+
## 5. Doubling down
24+
25+
- You can chain comparison operators, e.g. `9 <= hand_value <= 11`.
26+
- You can use the [conditional expression][conditional expression] (sometimes called a "ternary operator")
27+
to shorten simple `if`/`else` statements, e.g. `1 if card == 'A' else value_of_card(card)`.
28+
29+
[python comparisons tutorial]: https://docs.python.org/3/reference/expressions.html#comparisons
1830
[python comparisons examples]: https://www.tutorialspoint.com/python/comparison_operators_example.htm
19-
[equality comparison operator]: https://docs.python.org/3/reference/expressions.html#comparisons
20-
[order comparisons operator]: https://docs.python.org/3/reference/expressions.html#comparisons
21-
[membership test operations]: https://docs.python.org/3/reference/expressions.html#comparisons
31+
[int constructor]: https://docs.python.org/3/library/functions.html#int
32+
[if syntax]: https://docs.python.org/3/tutorial/controlflow.html#if-statements
33+
[conditional expression]: https://docs.python.org/3/reference/expressions.html#conditional-expressions

0 commit comments

Comments
 (0)