Return to Video

Improving Code Quality - Programming Foundations with Python

  • 0:01 - 0:03
    So I made a few changes to the code, see
  • 0:03 - 0:06
    if you agree with them. In the draw square function,
  • 0:06 - 0:08
    I now use a loop, and this loop does my
  • 0:08 - 0:12
    repetitive tasks, tasks like move the turtle forward and turn it
  • 0:12 - 0:17
    right, and this loop runs 4 times. Then I created
  • 0:17 - 0:20
    a new function called draw art, in this function I
  • 0:20 - 0:22
    create the window screen. This is the screen that has
  • 0:22 - 0:26
    the background color as red, and then I create my first
  • 0:26 - 0:29
    turtle, which I named brad. I change brad's shape,
  • 0:29 - 0:32
    color and speed, and then I call the draw square
  • 0:32 - 0:35
    function, so that I can actually draw my first
  • 0:35 - 0:39
    square. After that, I create my second turtle, angie. And
  • 0:39 - 0:42
    here are angie shape and color, and then angie
  • 0:42 - 0:45
    draws a circle. And then towards the end, I call
  • 0:45 - 0:48
    the draw_art function which is right here. So let
  • 0:48 - 0:51
    me go ahead and save, and run this program to
  • 0:51 - 0:54
    make sure everything is running fine. And there's our two
  • 0:54 - 0:57
    turtles. One drawing a square, the other one drawing a circle.
Cím:
Improving Code Quality - Programming Foundations with Python
Leírás:

03-13 Improving Code Quality

more » « less
Video Language:
English
Team:
Udacity
Projekt:
UD036 - OOP
Duration:
0:58

English subtitles

Felülvizsgálatok Compare revisions