Open study

is now brainly

With Brainly you can:

  • Get homework help from millions of students and moderators
  • Learn how to solve problems with step-by-step explanations
  • Share your knowledge and earn points by helping other students
  • Learn anywhere, anytime with the Brainly app!

A community for students.

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)
See more answers at
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.

Get this expert

answer on brainly


Get your free account and access expert answers to this and thousands of other questions

Whoops here is the code
pls use line numbers when referring to lines of code so we can find them easier. maybe use if/elif/else??
Thanks bwCA. The code I am referring to is in 425-434. Here is the result I am getting. 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'?

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

what is line 388 doing?
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.

Not the answer you are looking for?

Search for more explanations.

Ask your own question