235k views
4 votes
6.6 Code Practice: Question 1 in Edhesive

If u have done Edhesive and done this code practice show me how to make the boat please.

1 Answer

0 votes

Answer:

import simplegui

width = 600

height = 400

def draw(canvas):

# Water:

for x in range (1, 800, 120):

canvas.draw_circle ((x, 330), 60, 3, "Blue")

canvas.draw_line((1, 300), (width, 300), 70, "White")

# Boat

canvas.draw_circle((width/2, 280), 90, 5, "Black", "White")

canvas.draw_line((1, 220), (width, 220), 150, "White")

canvas.draw_line((210, 298), (390, 298), 5, "Black")

canvas.draw_line((width/2, 295),(width/2, 210), 5, "Black")

canvas.draw_line((width/2 + 60, 280),(width/2, 210),5, "Black")

canvas.draw_line((width/2 + 60, 280),(width/2, 280),5, "Black")

frame = simplegui.create_frame('Boat in Water', width, height)

frame.set_canvas_background("White")

frame.set_draw_handler(draw)

frame.start()

User Ali
by
5.3k points