EXTREME NOOB, lists?

Peter Hansen phansen at kaval.com
Fri Sep 1 23:59:17 EDT 2000


Quinn Dunkan wrote:
> 
> On Fri, 1 Sep 2000 21:30:03 -0400, skeetor <skeetornospam at bellsouth.net> wrote:
> >Ok, apparently I was unclear.  This language is still unfamiliar to me...
> >please help me.
> >I want to combine all the elif statements with the if statement to say.
> >"if a is equal to any number in list x then print a's range"
> >
> >here's what I have.
> >
> >a = input ("which dice: ")
> >def dice_numbers(a):
> >     a = a + 1
> >     b = range(1, a)
> >     print b
> >if a == 4:
> >     dice_numbers (a)
> >elif a == 6:
> >     dice_numbers (a)
> >elif a == 8:
> >     dice_numbers (a)
> >elif a == 10:
> >     dice_numbers (a)
> >elif a == 12:
> >     dice_numbers (a)
> >elif a == 20:
> >     dice_numbers (a)
> >elif a == 100:
> >     dice_numbers (a)
> >else:
> >     print ("try again")
> 
> if a in [4, 6, 8, 10, 12, 20, 100]:
>     ...
> 
> But what if you want 1d15?
> Or meta-dice which roll 1d(2d4) ?
> 
[snip]

1d15?

I don't remember that in AD&D... :-)



More information about the Python-list mailing list