[Tutor] Help with if-elif-else structure

TheIrda theirda at gmail.com
Fri Aug 26 15:55:14 CEST 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110826/99e2aa19/attachment.html>


More information about the Tutor mailing list