!”#$%&$”(
!”#$%&'(#)%”*#%*+%,-‘#.$*/().”(.*0
)*+,-./0$1/2 3*4/$*5$”67/08–#$9:;<=;<<$9#:( $ >/8? $ $ !
F$5/2$,-B0+/$655-B5,/4/57$26+$?-+7/I$-5$3HBL$S6R$’AL$<9<
%-B0+/ $ Q0-G0/++ $ )*+,B++*-5 $ &65IT-J $ UFV$WU0/XB/578R$F+M/I$VB/+7*-5+Y
$ %-B0+/$ #$ #$ #$ Q-M/0$)*,/
% $Q0/.*-B+ Instructions Poker Dice Run Length Encoding Hawaiian Language 1/J7 $& !”#$%&'()$
$ !””#$%&#'()*+’,%-. Q-M/0$)*,/$*+$6$+*4?8/$I*,/$G64/$2H/0/$R-B0$G-68$*+$7-$0-88$7H/$T/+7$?-++*T8/$?-M/0$H65I$2*7H$^./$+*J;+*I/I$I*,/E
)*,/$?-M/0$+,-0/+$065M/I$N0-4$H*GH/+7$7-$8-2/+7$60/$6+$N-88-2+#
Five of a kind
Four of a kind
Full house (three of a kind and a different pair)
Three of a kind
High die – rolling five singles where the rank of a high die is based on the highest roll among the singles with ones as highest then sixes, then fives etc.
“0*7/$6$NB5,7*-5#
2H*,H$,-5+B4/+$5-7H*5G$TB7$0/6I+$6$5B4T/0$*5?B7$N0-4$7H/$M/RT-60I$2*7H$7H/$?0-4?7# ON$7H/$*5?B7$5-7$6$.68*I$?-M/0$I*,/$0-88$W^./$I*,/$2*7H$7H/$I*G*7+$’$7H0-BGH$($*5,8B+*./YL$7H/$N-88-2*5G$/00-0$4/++6G/$*+$?0*57/I
Invalid Roll!
ON$7H/$B+/0$/57/0+$6$.68*I$I*,/$0-88L$7H/5$7H/$NB5,7*-5$0/7B05+$6$+70*5G$.68B/$2*7H$7H/$H*GH/+7$+,-0/$68-5G$2*7H$7H/$I*,/$.68B/W+Y$7H67$46M/$B?$7H/$0-88E$3H/$+70*5G$0/7B05$.68B/$2*88$T/$N-04677/I$6,,-0I*5G$7-$7H/$6T-./$8*+7$-N$+,-0/+E >/0/$60/$+-4/$/J64?8/+#
!!!!!$2-B8I$0/7B05$”Five of a kind: 4s”
!!”””$2-B8I$0/7B05$”Full house: 1s and 4s”$W2H/0/$7H/$^0+7$5B4T/0$*+$7H/$7H0//$-N$6$M*5I$65I$7H/$+/,-5I$*+$7H/$?6*0Y !!””#$2-B8I$0/7B05$”Two pairs: 1s and 4s”$W2H/0/$7H/$^0+7$5B4T/0$*+$7H/$H*GH/0$.68B/$5B4T/0Y “$%!#$2-B8I$0/7B05$”High die: 1”
Reminder: Ones (aces) are high, then sixes, fives, etc. F5$/J64?8/$-N$7H/$*57/06,7*-5$6N7/0$,688*5G$s = poker_dice()$*+$T/8-2$WB+/0$*5?B7$*+$T-8I/IY#
poker_dice()
Enter a roll:
Enter a roll: 1234 Invalid Roll! Enter a roll: 12325
65I$7H/$.68B/$-N$s$*+$+/7$7-$7H/$+70*5G$.68B/$”One pair: 2s”E F5-7H/0$/J64?8/$-N$7H/$*57/06,7*-5$6N7/0$,688*5G$s = poker_dice()$*+$T/8-2#
Enter a roll: 1234qophs Invalid Roll!
Enter a roll: a Invalid Roll!
Enter a roll: 11223
65I$7H/$.68B/$-N$s$*+$+/7$7-$7H/$+70*5G$.68B/$”Two pairs: 1’s and 2’s”E
F5-7H/0$/J64?8/$-N$7H/$*57/06,7*-5$6N7/0$,688*5G$s = poker_dice()$*+$T/8-2#
Enter a roll: 123456 Invalid Roll!
Enter a roll: 4424 Invalid Roll!
Enter a roll: ab 33326 Invalid Roll!
65I$7H/$.68B/$-N$s$*+$+/7$7-$NoneE
No submissions found
Note: If the on the last attempt just 33326 was entered instead of ab 33326, it would correspond to a poker_dice returning the string value “Three of a kind: 3s”.
1 2 3 4 5 6 7 8 9
import check
invalid_text = “Invalid Roll!”
input_prompt = “Enter a roll: ”
five_text = “Five of a kind: {0}s”
four_text = “Four of a kind: {0}s”
full_text = “Full house: {0}s and {1}s”
three_text = “Three of a kind: {0}s”
two_text = “Two pairs: {0}s and {1}s”
one_text = “One pair: {0}s”
high_text = “High die: {0}”
def poker_dice():
##YOUR CODE GOES HERE
check.set_input(“aloha”,”11234″)
check.set_print_exact(“Invalid Roll!”)
check.expect(“MarkUs Basic Test”, poker_dice(), “One pair: 1s”)
Code Output
ZB5$%-I/ &6./$%-I/
)*+,B++*-5
Topic: Week 3 / A3: Poker Dice
Show all posts
Z/+/7$%-I/
&H-2$>*+7-0R
&BT4*7$3-$S60M!+
S60M!+$&BT4*++*-5+
2*0.’3*+45++*”6 /00’%’1″+(
by recent activity
‘ Print-exact
For invalid input, we can have “check. set_print_exact” to check the Invalid input. However, there isn’t any print on the screen for those valid inputs. Thus, do we need to write this line or eliminate that, with onl…
‘ Given test invaild
the given test has an invalid input. But why the checkexpect section expects a Str type. Should it be none since no valid value is given? checkexpect should expect a Str if and only if the given is valid.
‘ Print or Return?
From what I understand, the function needs to print “Invalid Roll!” when there is an invalid input and returns string values. I’m confused by how to make the output of the function be a value and not None, since …
% $Q0/.*-B+ 1/J7 $&
C$!”$D58*5/E$F88$0*GH7+$0/+/0./I$/J,/?7$2H/0/$5-7/IE$/IKL$D?/5$/IK$65I$7H/*0$0/+?/,7*./$8-G-+$60/$0/G*+7/0/I$706I/460M+$-N$/IK$O5,E
3/04+$-N$&/0.*,/$P$>-5-0$%-I/$; $Q0*.6,R$Q-8*,R
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com