"Alan G" <[EMAIL PROTECTED]> wrote:

> > I .... Just need to figure out how to get 4 numbers from
> > the player on one line for easy comparison,
>
> Unless there is a set of batteries somewhere that I don't know
> about I think you have to rely on reading the line as a string
> and then splitting it.
>
> line = raw_input('Type 4 numbers separated by spaces: ')
> numbers = [int(n) for n in line.split(' ')]

Or if you want to assign these 4 numbers to separate variables, you can
use tuple unpacking:

a,b,c,d = map(int, raw_input('Type 4 numbers separated '
                             'by spaces:').split())

If you want to do error handling later, you may need to split this line
into two steps so that you can distinguish between invalid values and
wrong count of values (less or more than 4).

George

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to