[Tutor] Understanding what the code does behind the scenes

Kent Johnson kent37 at tds.net
Fri Oct 16 14:16:11 CEST 2009


On Fri, Oct 16, 2009 at 7:53 AM, Eike Welk <eike.welk at gmx.net> wrote:

> I have an other idea for a color function. It cam be embedded in the
> print statement because it returns an empty string:
>
>
> def color(color_num):
>    '''Change text color and return empty string.'''
>    textcolor(color_num)
>    return ''
>
> print "There are", color(4), apples_left, \
>      color(7), "left in the basket."

This will put double spaces between the actual strings.

Kent


More information about the Tutor mailing list