[Tutor] Help with if-elif-else structure

Bspymaster bspymaster at gmail.com
Sat Aug 27 01:37:36 CEST 2011


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 <theirda at gmail.com> wrote:

> 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 6's? I mean
> result > 15 and 2 1's is always a critical success even if multiple 6 are
> rolled?
>
> also
>
> if roll[0] > 15:
>    .........
> elif roll[0] <=15:  <--- this is redundant. already checked for > 15 so if
> here is always <= 15
>     if roll[1] >= 2:
>
> you can change with:
>
> elif roll[1] >= 2:
>
>
>
> And... which is the RPG name ? :p
> Cheers
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110826/0c617318/attachment.html>


More information about the Tutor mailing list