anonymous
  • anonymous
Hi. I've got a question on PS3b. I've attached the code. My question is about the play_games function(toward the bottom of the code): Under the "if choose == 'n' or choose == 'r':" How can I get the program to produce a new handz (randomly generated hand) when the user selects 'n', but keep the previous handz (the hand that was generated on the previous while loop) when the user selects 'r'? Right now when the user selects 'r', handz generates a new random hand.
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
Whoops here is the code http://pastebin.com/H6vpKqGd
anonymous
  • anonymous
pls use line numbers when referring to lines of code so we can find them easier. maybe use if/elif/else?? http://pastie.org/4900295 http://docs.python.org/reference/compound_stmts.html#the-if-statement
anonymous
  • anonymous
Thanks bwCA. The code I am referring to is in 425-434. http://pastebin.com/H6vpKqGd Here is the result I am getting. http://pastebin.com/4sVCLSK5 After I enter 'n' in the raw_input, the program generates a new random hand(line 6). Then after the play_hand functions runs (line 8) the program goes to the beginning of the while loop (line 9). At this point when I enter 'r', I would like the program to show the same hand in line 6. but instead it shows a new one (line 10). How can I fix this problem and get 'r' to produce the same hand as 'n'?

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
what is line 388 doing?
anonymous
  • anonymous
Yep you are right line 388 is the culprit. I was assigning hand to deal_hand in the play_hand function which results in a new random hand every time its run. Thank you for your help.

Looking for something else?

Not the answer you are looking for? Search for more explanations.