[Tutor] How to get 4 numbers from the user in one line for easycomparision?

Alan G alan.gauld at freenet.co.uk
Sun Jul 3 10:03:52 EDT 2005


> 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(' ')]

HTH,

Alan G.




More information about the Python-list mailing list