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]>
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
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
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
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
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
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")
>
>> #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
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