> Dawson) Game Over 2.0 program in chapter two on page 17. The object of
> this program is to do ASCII-style art to generate a large rendition of
> "Game Over" using the following characters: "_" , "\" , "|" , and "/"
> . When my son tried to do his version, the "Over" portion did not
> print correctly.

Hi boB,


Ah ha.  Escape characters.  I see what you mean.  :P


Just to add: there is a "raw" string literal syntax that will turn off
escape sequence handling.  Using a raw string literal may make it
easier to type the value in question.

We can use raw literal strings by prepending a 'r' in the front of the
string literal.  e.g.:

##########################################
>>> x = r'''
... this\
... is\
... a/
... test\
... '''
>>> x
'\nthis\\\nis\\\na/\ntest\\\n'
>>> print x

this\
is\
a/
test\
##########################################


It might be that the question is trying to motivate the use of raw
string literals, or teaching about escape sequences.  I don't have the
book, so I can't say for sure.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to