Re: [Tutor] Help with if-elif-else structure

2011-08-27 Thread Emile van Sebille
Behalf Of TheIrda Sent: Friday, August 26, 2011 8:55 AM To: Christopher King Cc: python mail list Subject: Re: [Tutor] Help with if-elif-else structure Hello, I'm quite new on python, so don't hit too hard if I'm wrong ;) A question on the logic... Does this means if roll[0]>

Re: [Tutor] Help with if-elif-else structure

2011-08-27 Thread TheIrda
asad | JPMorgan Chase Investment Bank | Currencies Technology > 712 Main Street | Houston, TX 77002 > work phone: 713 - 216 - 5423 > > > From: tutor-bounces+ramit.prasad=jpmorgan@python.org > [mailto:tutor-bounces+ramit.prasad=jpmorgan@python.org] On Behalf Of > T

Re: [Tutor] Help with if-elif-else structure

2011-08-26 Thread Peter Otten
Robert Sjoblom wrote: > #assuming target number 15 > roll = (result, initial_mins, initial_max) > if roll[0] > 15: > if roll[1] >= 2: > print("Success") > elif roll[2] >= 2: > print("Critical failure!") > else: > print("Failure.") > elif roll[0] <= 15: > if

Re: [Tutor] Help with if-elif-else structure

2011-08-26 Thread Bspymaster
Well, I'm not sure what your asking for the first question, but for the second one, you would have an unhandled exception in your code if roll[0] was less than or equal to 0. Hope that helps a bit! On Fri, Aug 26, 2011 at 8:55 AM, TheIrda wrote: > Hello, > > I'm quite new on python, so don't hi

Re: [Tutor] Help with if-elif-else structure

2011-08-26 Thread Prasad, Ramit
002 work phone: 713 - 216 - 5423 From: tutor-bounces+ramit.prasad=jpmorgan@python.org [mailto:tutor-bounces+ramit.prasad=jpmorgan....@python.org] On Behalf Of TheIrda Sent: Friday, August 26, 2011 8:55 AM To: Christopher King Cc: python mail list Subject: Re: [Tutor] Help with if-elif-else str

Re: [Tutor] Help with if-elif-else structure

2011-08-26 Thread TheIrda
Hello, I'm quite new on python, so don't hit too hard if I'm wrong ;) A question on the logic... Does this means if roll[0] > 15: if roll[1] >= 2: print("Success") elif roll[2] >= 2: print("Critical failure!") that rolling multiple 1's get the priority on rolling multiple

Re: [Tutor] Help with if-elif-else structure

2011-08-25 Thread Christopher King
Looks good, although I would add one or two things. > #assuming target number 15 > Put that in a variable for the target number > roll = (result, initial_mins, initial_max) > if roll[0] > 15: >if roll[1] >= 2: You could even put all the constants in variables > print("Success") >

Re: [Tutor] Help with if-elif-else structure

2011-08-25 Thread Robert Sjoblom
>> #assuming target number 15 >> roll = (result, initial_mins, initial_max) > I'd forget the tuple and just use the names, > it is more readable that way... >if result > 15: >if initial_mins >= 2:... >elif initial_max >=2:... > But otherwise it seems to reflect the rules as you've writte

Re: [Tutor] Help with if-elif-else structure

2011-08-25 Thread Alan Gauld
On 25/08/11 08:51, Robert Sjoblom wrote: If I roll two sixes (on the initial roll) and below the target number (in total), it's a failure. If I roll two sixes (on the initial roll) and above the target number (in total), it's a critical failure. If I roll two ones (on the initial roll) and abov