Skip to content

Commit 70191db

Browse files
committed
Merge branch 'main' of https://github.com/PdxCodeGuild/class_HB2 into kelin-lab03-number-to-phrases
2 parents a05a5d1 + c2ca40b commit 70191db

File tree

5 files changed

+79
-1
lines changed

5 files changed

+79
-1
lines changed

1 Python/labs/04 Black Jack Advice

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Lab 4: Blackjack Advice
2+
3+
Let's write a python program to give basic blackjack playing advice during a game by asking the player for cards.
4+
First, ask the user for three playing cards (A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, or K).
5+
Then, figure out the point value of each card individually. Number cards are worth their number, all face cards are worth 10.
6+
At this point, assume aces are worth 1. Use the following rules to determine the advice:
7+
8+
Less than 17, advise to "Hit"
9+
Greater than or equal to 17, but less than 21, advise to "Stay"
10+
Exactly 21, advise "Blackjack!"
11+
Over 21, advise "Already Busted"
12+
13+
Print out the current total point value and the advice.
14+
15+
What's your first card? Q
16+
What's your second card? 2
17+
What's your third card? 3
18+
15 Hit
19+
20+
What's your first card? K
21+
What's your second card? 5
22+
What's your third card? 5
23+
20 Stay
24+
25+
What's your first card? Q
26+
What's your second card? J
27+
What's your third card? A
28+
21 Blackjack!
29+
30+
Version 2 (optional)
31+
32+
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.
33+
Try generating a list of all possible hand values by doubling the number of values in the output whenever you encounter an ace.
34+
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.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Presentation Day: November 4th, 2022
3131
| --- | ---------------------- | ------------- | --------------------- | ------------- |
3232
| 01 | Lab Average Numbers | 28 Jun | 05 Jul | 12 Jul |
3333
| 02 | Lab Unit Converter | 30 Jun | 08 Jul | 14 Jul |
34-
| 03 | Lab | 00 Jun | 00 Jun | 00 Jun |
34+
| 03 | Lab Number To Phrase | 01 Jul | 09 Jul | 15 Jul |
3535
| 04 | Lab | 00 Jun | 00 Jun | 00 Jun |
3636
| 05 | Lab | 00 Jun | 00 Jun | 00 Jun |
3737
| 06 | Lab | 00 Jun | 00 Jun | 00 Jun |

code/Andy/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ Andy
44

55
Github Username:
66
andy2124
7+

code/Andy/python.py

Whitespace-only changes.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#version 1
2+
units = {
3+
"feet": 0.3048,
4+
"meters": 1
5+
}
6+
distance = input("Enter Lenth of feet:")
7+
distance= int(distance)
8+
total = distance * units["feet"]
9+
print(f"{distance} FT is {total} Meters")
10+
11+
#version 2
12+
units_mesurments = {
13+
"feet": 0.3048,
14+
"miles": 1609.34,
15+
"meters": 1,
16+
"kilometers": 1000
17+
}
18+
19+
distance = input("what is the distance?")
20+
units = input("what are the units?:")
21+
calling = units_mesurments[units]
22+
distance = int(distance)
23+
total = distance * calling
24+
25+
print(f"{distance} {units} is {total} Meters")
26+
27+
#version 3
28+
units_mesurments = {
29+
"feet": 0.3048,
30+
"miles": 1609.34,
31+
"meters": 1,
32+
"kilometers": 1000,
33+
"yards": 0.9144,
34+
"inches": 0.0254
35+
}
36+
37+
distance = input("what is the distance?")
38+
units = input("what are the units?:")
39+
calling = units_mesurments[units]
40+
distance = int(distance)
41+
total = distance * calling
42+
43+
print(f"{distance} {units} is {total} Meters")

0 commit comments

Comments
 (0)