#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    1
    Rep Power
    0

    What is optional for python programming?


    What is optional for python programming?
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2005
    Posts
    606
    Rep Power
    65
    You got to be more specific!
    Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25
  4. #3
  5. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,837
    Rep Power
    480
    Use of a computer is optional. Pen and paper is sufficient. Example, here is a faulty python program that for me sufficiently solves the problem:
    Code:
    # Suppose  you're on  a game  show, and you're  given the  choice of
    # three doors: Behind  one door is a car; behind  the others, goats. You
    # pick a  door, say  No. 1, and  the host,  who knows what's  behind the
    # doors, opens another  door, say No. 3, which has a  goat. He then says
    # to you, "Do you  want to pick door No. 2?" Is  it to your advantage to
    # switch your choice?
    
    def monty_hall_simulation():
        car = random.choice((1,2,3,))  # door with car
        print('Contestant chooses door 1.')
        if car == 1:                        # this happens 1/3 of the time
            goat = random.choice((2,3,))
            result = 'the goat'
        elif carr == 2:                    # 1/3 of the time deterministic
            goat = 3
            result = 'CAR BEHIND DOOR 2'
        else:                              # 1/3 of the time deterministic
            goat = 2
            result = 'CAR BEHIND DOOR 3'
    
        print('Monty Hall reveal goat at door %d'%goat)
        print('You change your mind and win %s'%result)
    [code]Code tags[/code] are essential for python code and Makefiles!
  6. #4
  7. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2005
    Posts
    606
    Rep Power
    65
    Copious amounts of coffee and cookies might be optional for some Python programmers.

    Comments on this post

    • b49P23TIvg agrees : Mountain Dew!
    • codergeek42 agrees : Coffee is most certainly _NOT_ optional for most of us. :P
    Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Location
    Tewksbury, MA
    Posts
    36
    Rep Power
    2
    Object Oriented Programming is OOPtional...
  10. #6
  11. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2005
    Posts
    606
    Rep Power
    65

    Wink


    Originally Posted by Marbelous
    Object Oriented Programming is OOPtional...
    It's amazing how often I whip up a small utility program to help out with file management, and look Ma no OOP!
    Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25

IMN logo majestic logo threadwatch logo seochat tools logo