Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

tcc8m

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.

  • one year ago
  • one year ago

  • This Question is Closed
  1. tcc8m
    Best Response
    You've already chosen the best response.
    Medals 0

    Whoops here is the code http://pastebin.com/H6vpKqGd

    • one year ago
  2. bwCA
    Best Response
    You've already chosen the best response.
    Medals 1

    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

    • one year ago
  3. tcc8m
    Best Response
    You've already chosen the best response.
    Medals 0

    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'?

    • one year ago
  4. bwCA
    Best Response
    You've already chosen the best response.
    Medals 1

    what is line 388 doing?

    • one year ago
  5. tcc8m
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

    • one year ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.