Previous Lecture Complete and continue  

  Lesson 6: Fun Fun Function

After watching the video, I want you to write a function that draws a square when you run it.

36 comments
christopher Winters
import turtle

my_turtle = turtle.Turtle()

def square():
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(100)

square()
my_turtle.forward(100)
square()



ziad002
import turtle


def square():
turtle.forward(100)
turtle.left(90)
turtle.forward(100)
turtle.left(90)
turtle.forward(100)
turtle.left(90)
turtle.forward(100)
turtle.left(90)
turtle.forward(100)

square()
turtle.forward(100)
square()
sweta
Hi, It is showing there is a parse error at line 4, could you please check it.

import turtle
t = turtle.Turtle()
def square():
t.forward(100)
t.right(90)
t.forward(100)
t.right(90)
t.forward(100)
t.right(90)
t.forward(100)

square()
Aman Tyagi
it works now..

https://repl.it/FJSj/1
ANURAG SHARMA
u need to give some indentations like space or tab after giving the command for defining the function.
like:
def square():
t.forward(100)
t.forward(100)
t.forward(100)
square()
after defining the function u can come back to the default indentation
Fortune
# A function saves us from the hassle of repeating the same line of code over and over.
import turtle
zig = turtle.Turtle()
#define the function saviour
def savior():

zig.forward(100)
zig.left(50)
zig.forward(100)
zig.left(40)
zig.forward(100)
zig.left(50)
zig.forward(100)
zig.left(40)
zig.forward(100)
zig.left(50)
zig.forward(100)
zig.left(39)
zig.forward(100)
zig.left(50)
zig.forward(100)

savior()
print ("yahoo")


savior()

savior()

savior()

savior()

savior()

savior()

savior()

savior()
Aman Tyagi
# A function saves us from the hassle of repeating the same line of code over and over.
import turtle
zig = turtle.Turtle()
#define the function saviour
zig.speed(10)
def savior():

zig.forward(60)
zig.left(40)
zig.forward(60)
zig.left(40)
zig.forward(60)
zig.left(40)
zig.forward(60)
zig.left(40)
zig.forward(60)
zig.left(40)
zig.forward(60)
zig.left(40)
zig.forward(60)
zig.left(40)
zig.forward(60)

savior()
print ("yahoo")


savior()

savior()

savior()

savior()

savior()

savior()

savior()

savior()

#better?
Aman Tyagi
#amateur art work
import turtle


wn = turtle.Screen()
wn.bgcolor('black')
rat = turtle.Turtle()
rat.speed(0)
rat.color('white')
rotate=int(360)


def drawCircles(t,size):
for i in range(10):
t.circle(size)
size=size-4
def drawSpecial(t,size,repeat):
for i in range(repeat):
drawCircles(t,size)
t.right(360/repeat)
drawSpecial(rat,100,10)


cat = turtle.Turtle()
cat.speed(0)
cat.color('yellow')
rotate=int(90)
def drawCircles(t,size):
for i in range(4):
t.circle(size)
size=size-10
def drawSpecial(t,size,repeat):
for i in range (repeat):
drawCircles(t,size)
t.right(360/repeat)
drawSpecial(cat,100,10)

Bat = turtle.Turtle()
Bat.speed(0)
Bat.color('blue')
rotate=int(90)
def drawCircles(t,size):
for i in range(4):
t.circle(size)
size=size-5
def drawSpecial(t,size,repeat):
for i in range (repeat):
drawCircles(t,size)
t.right(360/repeat)
drawSpecial(Bat,100,10)

turtle.done()

Terry = turtle.Turtle()
Terry.speed(0)
Terry.color('orange')
rotate=int(90)
def drawCircles(t,size):
for i in range(4):
t.circle(size)
size=size-19
def drawSpecial(t,size,repeat):
for i in range (repeat):
drawCircles(t,size)
t.left(360/repeat)
drawSpecial(Terry,100,10)
Praneeth
import turtle
a = turtle.Turtle()

# This icode is defing a square
def square():
a.forward(50)
a.left(90)
a.forward(50)
a.left(90)
a.forward(50)
a.left(90)
a.forward(50)
a.left(90)

# this is for drawing a square
square()

Teron Chapman
import turtle
#You can Rename your turtle using a variable. Try it out.
Peter = turtle.Turtle()
#Peter can move according to my command. Watch This.
Peter.forward(100)
#Peter can also turn left and right. Look at Peter go!!
Peter.left(90)
Peter.forward(100)
Peter.left(90)
Peter.forward(100)
Peter.left(90)
Peter.forward(200)
#That's a lot of work to move Peter in a Square! Let's simplify the code by using Variables again.
def square():
Peter.forward(100)
Peter.left(90)
Peter.forward(100)
Peter.left(90)
Peter.forward(100)
Peter.left(90)
Peter.forward(100)
# We've just created a Function! It's an easier way to define a pathway for the Turtle.
# NOTE: Defining the function will not run the function. You have to acknowledge the function in order for it to start!
square()
# You Can Stack functions and give translations to make coding easier!
Peter.forward(200)
square()
Peter.forward(100)
square()
Peter.forward(200)
James Daniel Smith
import turtle


my_turtle = turtle.Turtle()


def square():
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(100)

square()

my_turtle.forward(100)

square()
Samson Gao
Here's my 1000 line code for this shape. Looks so nice :O. I wish i could've added color to the cubes

import turtle

my_turtle = turtle.Turtle()

def square():

my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward (100)
my_turtle.left (180)
my_turtle.forward (100)
my_turtle.right (45)
my_turtle.forward(50)
my_turtle.right (45)
my_turtle.forward (100)
my_turtle.right (90)
my_turtle.forward (100)
my_turtle.right(42)
my_turtle.forward (50)
my_turtle.backward(50)
my_turtle.left(42)
my_turtle.backward(100)
my_turtle.right(225)
my_turtle.backward(50)

square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()
my_turtle.right(1)
my_turtle.forward(69)
square()

Ali
https://repl.it/Ezq6/2
Abdulla Omaruddin
import turtle


def square ():
my_turtle = turtle.Turtle ()
my_turtle.forward (100)
my_turtle.left (90)
my_turtle.forward (100)
my_turtle.left (90)
my_turtle.forward (100)
my_turtle.left (90)
my_turtle.forward (100)

square ()
Juan Jose Rios Jr
import turtle
bobby = turtle.Turtle()

def fore():
bobby.forward(100)
bobby.left(90)
bobby.forward(150)
bobby.left(90)
bobby.forward(150)
bobby.left(90)
bobby.forward(150)

fore()
bobby.forward(50)
fore()
bobby.forward(50)
fore()
bobby.forward(50)
fore()
Miroslav
https://repl.it/Ezq6/1
Noah Lemasters
import turtle
my_turtle = turtle.Turtle()
wn = turtle.Screen()
wn.bgcolor('red')
my_turtle.color('black')
def A():
my_turtle.forward(100)
my_turtle.left(45)
my_turtle.forward(100)
my_turtle.left(45)
my_turtle.forward(100)
my_turtle.left(45)
my_turtle.forward(100)
my_turtle.left(45)
my_turtle.forward(100)
my_turtle.left(45)
my_turtle.forward(100)
my_turtle.left(45)
my_turtle.forward(100)
my_turtle.left(45)
my_turtle.forward(100)
my_turtle.left(45)
A()
Ereatara Kokiri
def square(length):
my_turtle.forward(length)
my_turtle.right(90)
my_turtle.forward(length)
my_turtle.right(90)
my_turtle.forward(length)
my_turtle.right(90)
my_turtle.forward(length)

square(100)
square(50)
square(60)
Ereatara Kokiri
def a function and calling a function is awesome
def square():
my_turtle.forward(100)
my_turtle.right(90)
my_turtle.forward(100)
my_turtle.right(90)
my_turtle.forward(100)
my_turtle.right(90)
my_turtle.forward(100)

square()
my_turtle.forward(100)
square()
Anant Dnyaneshwar Gaikwad
https://trinket.io/python/f25ff3675b
Rocelio Garcia
import turtle

fuck = turtle.Turtle()

def fucksquare():
for i in range(4):
fuck.forward(100)
fuck.left(90)

fucksquare()
Rocelio Garcia
import turtle

fuck = turtle.Turtle()
fuck.speed(10)
def fucksquare():
for i in range(4):
fuck.forward(100)
fuck.left(90)

fucksquare()
Diwaker Thakur
import turtle
my_turtle = turtle.Turtle()

def tringle():
my_turtle.forward(100)
my_turtle.left(120)
my_turtle.forward(100)
my_turtle.left(120)
my_turtle.forward(100)
tringle()
my_turtle.forward(100)
tringle()
James Goguen
import turtle

my_turtle = turtle.Turtle()

def Zach():
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(100)

Zach()
Xerxes
import turtle

t = turtle.Turtle()

def square():
t.forward(100)
t.left(90)
t.forward(100)
t.left(90)
t.forward(100)
t.left(90)
t.forward(100)
t.left(90)

square ()
t.forward(100)
square ()
sonam chophel
import turtle
wn=turtle.Screen()
wn.bgcolor('red')
ya=turtle.Turtle()
ya.speed(50)
def squeeer():
ya.forward(100)
ya.left(90)
ya.forward(100)
ya.left(90)
ya.forward (100)
ya.left (90)
ya.forward(100)
ya.speed(50)
squeeer()
ya.forward(100)
squeeer()
ya.forward(100)
squeeer()
ya.forward(100)
squeeer()
ya.forward(100)
ya.speed(50)
def smlsquar():
for i in range(4):
ya.forward(80)
ya.left(90)
smlsquar()
ya.speed(50)
def pause():
ya.right(90)
ya.forward(100)
for i in range(3):
pause()
smlsquar()
ya.speed(50)
def msmlsquar():
for i in range(3):
ya.forward(60)
ya.left(90)
for i in range(4):
msmlsquar()
ya.forward(160)
ya.speed(50)
ya.right(135)
ya.forward(141)
ya.right(135)
ya.forward(100)
ya.right(135)
ya.forward(141)
Md Abdullah Al Maruf
import turtle

turtle=turtle.Turtle()

def squre():
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
squre()


turtle.forward(100)
squre()


turtle.forward(100)
squre()


turtle.forward(100)
squre()
Alexander Helms
import turtle


my_turtle = turtle.Turtle()


#square
def square():
my_turtle.forward(100)

my_turtle.left(90)

my_turtle.forward(100)

my_turtle.left(90)

my_turtle.forward(100)

my_turtle.left(90)

my_turtle.forward(100)

my_turtle.right(90)

my_turtle.forward(100)

my_turtle.right(90)

my_turtle.forward(100)

my_turtle.right(90)

my_turtle.forward(100)

my_turtle.right(90)

my_turtle.forward(200)

my_turtle.right(90)

my_turtle.forward(100)

my_turtle.right(90)

my_turtle.forward(100)

my_turtle.right(90)

my_turtle.forward(200)

my_turtle.right(90)

my_turtle.forward(100)

my_turtle.right(90)

my_turtle.forward(100)

def diamond():

my_turtle.right(45)

my_turtle.forward(141)

my_turtle.right(90)

my_turtle.forward(141)

my_turtle.right(90)

my_turtle.forward(141)

my_turtle.right(90)

my_turtle.forward(141)


def half():
square()
diamond()
square()
diamond()

def one():
half()
half()

one()
one()
Nick Fuller
I thought this was pretty cool. I just made another function that used the previously defined function in a way to create three squares at once. (the comments are just what i left when i was messing around with the square function)

import turtle
my_turtle = turtle.Turtle()

def square():
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(100)


#square()
#square()
#my_turtle.left(90)
#my_turtle.forward(100)
#square()


def threesquares():
square()
square()
my_turtle.left(90)
my_turtle.forward(100)
square()

threesquares()
Kyle Judd
import turtle

my_turtle = turtle.Turtle()

def drawSquare():
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(100)

drawSquare()
my_turtle.forward(100)
drawSquare()
shree
import turtle
boom=turtle.Turtle()

def name():
boom.forward(100)
print("my name is shree!!")
x=19
print(x)
name()
print(" it's cool stuf to do it again and again")
name()
Elian Barajas
import turtle

mark = turtle.Turtle()


# here we are defining a function
# we've named our function " square "
# this will instruct mark to form a square
# after defining a function we have to make sure we indent the instructions of our function " square "
def square():
mark.forward(100)
mark.right(90)
mark.forward(100)
mark.right(90)
mark.forward(100)
mark.right(90)
mark.forward(100)

# here we call our function " square "
# then we ask mark our turtle to move forward
# once again we call our function " square "

square()
mark.forward(100)
square()

Abhishek Gaur
Where am I going wrong?

import turtle

# This part makes two squares that look like a uk flag

def uk():

my_turtle = turtle.Turtle()
my_turtle.forward(100)
my_turtle.right(90)
my_turtle.forward(100)
my_turtle.right(90)
my_turtle.forward(100)
my_turtle.right(90)
my_turtle.forward(200)
my_turtle.left(90)
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(200)
my_turtle.left(90)
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(100)
my_turtle.left(90)
my_turtle.forward(200)
my_turtle.right(90)
my_turtle.forward(100)
my_turtle.right(90)
my_turtle.forward(100)
my_turtle.right(90)
my_turtle.forward(100)
my_turtle.right(45)
my_turtle.forward(143)
my_turtle.left(135)
my_turtle.forward(200)
my_turtle.left(135)
my_turtle.forward(285)
my_turtle.left(225)
my_turtle.forward(200)
my_turtle.right(135)
my_turtle.forward(143)

uk()
my_turtle.left(45)
my_turtle.forward(200)
uk()

Fortune
Code is ok, Make sure the block is indented after defining the function.
Stefan Kirilov
Hey, Abhishek.

def uk(x,y) - you have to set some attributes to UK For instance where you write forward(100) and left(90) change them to forward(x) and left(y).

After that you need to set some values to X and Y:
uk(100,90)
Stefan Kirilov
@Abhishek Gaur I ran your code, didn't see anything wrong with it.