What use for reversed()?
Tim Delaney
timothy.c.delaney at gmail.com
Sun May 31 23:59:01 EDT 2015
On 1 June 2015 at 10:30, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
> On 01/06/2015 00:23, Tim Delaney wrote:
>
>> The for statement must have a colon at the end of line e.g. a complete
>> for statement and block is:
>>
>> for br in b:
>> print br
>>
>> This will output the characters one per line (on Python 3.x), since that
>> is what the reversed() iterator will return. You will need to do
>> something else to get it back to a single string.
>>
>
> Will it indeed? Perhaps fixing the syntax error will get something to
> print :)
Indeed - as Mark is so gently alluding to, I've done the reverse of what I
said - given Python 2.x syntax instead of Python 3.x.
That should have been:
for br in b:
print(br)
Tim Delaney
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150601/d5b4df53/attachment.html>
More information about the Python-list
mailing list