# ----- DRILL ----- # Write two functions hello and goodbye # The function hello prints "hello" and then calls the function goodbye # The function goodbye prints "goodbye" # The main body of your code should call hello once # ----- SOLUTION ----- def hello(): print( "Hello" ) goodbye() def goodbye(): print( "Goodbye" ) hello() # DRAW A CIRCLE import drawSvg as draw d = draw.Drawing(200, 200, origin='center') d.append(draw.Circle(0,0,30)) # render a circle d # display drawing # DRAW A RED CIRCLE WITH A BLACK OUTLINE import drawSvg as draw d = draw.Drawing(200, 200, origin='center') d.append(draw.Circle(0,0,50, fill='red', stroke_width=1, stroke='black')) # render a circle d # display drawing # draw something using badly commented and written code import drawSvg as draw d = draw.Drawing(200, 200, origin='center') d.append(draw.Rectangle(0,-100,100,100, fill='gray', stroke='black')) d.append(draw.Lines(0,0, 100,0, 50,50, close=True, fill='green', stroke='black')) d.append(draw.Rectangle(40,-100,20,50, fill='red', stroke='black')) d.append(draw.Rectangle(15,-30,15,15, fill='white', stroke='black')) d.append(draw.Rectangle(70,-30,15,15, fill='white', stroke='black')) d # draw a simple house import drawSvg as draw d = draw.Drawing(200, 200, origin='center') d.append(draw.Rectangle(0,-100,100,100, fill='gray', stroke='black')) # body of house d.append(draw.Lines(0,0, 100,0, 50,50, close=True, fill='green', stroke='black')) # roof d.append(draw.Rectangle(40,-100,20,50, fill='red', stroke='black')) # door d.append(draw.Rectangle(15,-30,15,15, fill='white', stroke='black')) # left window d.append(draw.Rectangle(70,-30,15,15, fill='white', stroke='black')) # right window d # display drawing # A good coding practice: # 1.) think, think, think # 2.) sketch # 3.) think more # 4.) write 2-3 lines of code # 5.) test your code # 6.) test your code # 7.) test your code # 8.) goto step 4