while and if

Calvin79 del at mjclift.freeserve.co.uk
Fri Aug 13 00:33:24 EDT 2004


Hi,

I'm very new to python, but believe in learning from examples. So could
someone please help me with this?

I choose a number of 'things' I want 

Number = input("Number of things (1-8)? ")
things = ['1', '2', '3', '4', '5', '6', '7',\
'8']

>From there I want to take at random a letter and do this n times depending
on the number I gave.

choice = choice('abcd')

The final answer if say the number had been 5 to look something like;

choice 1 = d
choice 2 = c
choice 3 = a
choice 4 = d
choice 5 = b
etc...

I can sort of see how to use the while loop for int but not to keep
choosing from the list and lable it choice 1 etc...

Thanks for any help,

Calvin 




More information about the Python-list mailing list