#----------------------------------------------------------------------- # dragon2.py #----------------------------------------------------------------------- import stdio import sys # Accept n as a command-line argument. Write to standard output # the instructions for drawing a dragon curve of order n. n = int(sys.argv[1]) dragon = 'F' nogard = 'F' for i in range(1, n+1): temp = dragon # save away copy of dragon dragon = str(dragon) + 'L' + str(nogard) nogard = temp + 'R' + nogard # use old value of dragon stdio.writeln(dragon) #----------------------------------------------------------------------- # python dragon2.py 1 # FLF # python dragon2.py 2 # FLFLFRF # python dragon2.py 3 # FLFLFRFLFLFRFRF # python dragon2.py 4 # FLFLFRFLFLFRFRFLFLFLFRFRFLFRFRF # python dragon2.py 5 # FLFLFRFLFLFRFRFLFLFLFRFRFLFRFRFLFLFLFRFLFLFRFRFRFLFLFRFRFLFRFRF