how to do draw pattern with python?
Mark Lawrence
breamoreboy at yahoo.co.uk
Fri Sep 21 15:55:02 EDT 2012
On 21/09/2012 15:29, Peter Otten wrote:
> echo.hping at gmail.com wrote:
>
>> may i know how to shift the bits using only looping and branching??
>
> import time
>
> data = """\
> x....x
> .x..x.
> ..xx..
> ..xx..
> .x..x.
> x....x
>
> """.splitlines()
>
> data = [line * 12 for line in data] # optional
>
> while True:
> print "\x1b[2J\x1b[0;0H" # optional
> for i, line in enumerate(data):
> print line
> data[i] = line[1:] + line[:1]
> time.sleep(.1)
>
> Doing your homework since 2001 ;)
>
I tried running your code but got this:-
c:\Users\Mark>pattern.py
File "C:\Users\Mark\pattern.py", line 22
Doing your homework since 2001
^
SyntaxError: invalid syntax
What am I doing wrong?
--
Cheers.
Mark Lawrence.
More information about the Python-list
mailing list