Input without line break, is it possible?
Chris Angelico
rosuav at gmail.com
Wed Dec 4 11:14:18 EST 2013
On Thu, Dec 5, 2013 at 3:04 AM, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
> On 04/12/2013 15:38, geezle86 at gmail.com wrote:
>>
>> The source code:
>>
>> for i in range(8):
>> n = input()
>
> Yes you can get them on a single line, see the response from Tim Chase. But
> just to be crystal clear, are you aware that you're getting string
> representations of numbers, and not the numbers themselves?
Just to clarify, this is assuming that you're using Python 3. Geezle,
if you're using Python 2, you need to not use input() for anything -
use raw_input() instead, which will do what we're describing here.
I yearn for the day when nobody uses Python 2 any more so this doesn't
need to be asked.
ChrisA
More information about the Python-list
mailing list