Compsci 06/101, Spring 2011, Lab 5

By entering your name/net-id below you indicate you are present for Lab 5 to answer these questions and that you were part of the process that resulted in answers being turned in.

Name: ______________    Net id: _____________ || Name: ______________    Net id: _____________

Name: ______________    Net id: _____________ || Name: ______________    Net id: _____________

Part 0: Thinking About Code

  1. What does the graph look like? Justify.
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  2. Why write code to generate one roll at a time rather than use a list?
    
    
    
    
    
    
    
  3. Purpose/use of rc:
    
    
    
    
    
    
    
    
    
  4. Purpose/use of counts:
    
    
    
    
    
    
    
    
    
    
    

Part I: Craps Odds

What are probabilities of winning and losing in craps on the first roll?

win (7 or 11) =



lose (2, 3, or 12) =

Write what you consider the important part of the code that calculates the probabilities.













Part II: Poker Odds

  1. What odds did you calculate for each of the following poker hands?

    Part III: Pi Challenge

  2. Write your Python code for pi_estimate below.