Previous Lecture Complete and continue  

  Lesson 7: Functions with Multiple Arguments

22 comments
wenting zhang
https://repl.it/FNny/0
PaRuSch
Went a little bit more fancy with all the stuff I learned till now. Go copy and test it yourself ^-^
https://repl.it/FKuw/0
Praneeth
import turtle
a = turtle.Turtle()
def polygon(length , angle):
a.forward(length)
a.right(angle)
a.forward(length)
a.right(angle)
a.forward(length)
a.right(angle)
a.forward(length)
a.right(angle)
a.forward(length)
a.right(angle)
a.forward(length)
a.right(angle)
a.forward(length)
a.right(angle)
a.forward(length)
a.right(angle)

polygon(25 , 90)
a.forward(100)
polygon(25 , 45)

Edmundo Aguirre
import turtle

my_turtle = turtle.Turtle()

def square(length,angle):


my_turtle.forward(length)
my_turtle.right(angle)
my_turtle.forward(length)
my_turtle.right(angle)
my_turtle.forward(length)
my_turtle.right(angle)
my_turtle.forward(length)
my_turtle.right(angle)
my_turtle.forward(length)
my_turtle.right(angle)
my_turtle.forward(length)
my_turtle.right(angle)
my_turtle.forward(length)
my_turtle.right(angle)
my_turtle.forward(length)

square(100,45)
#square(150)
#square(50)
shane
import turtle
my_turtle = turtle . Turtle()
def square(length, angle):


my_turtle.forward(length)
my_turtle.left(angle)
my_turtle.forward(length)
my_turtle.left(angle)
my_turtle.forward(length)
my_turtle.left(angle)
my_turtle.forward(length)



square(100,90,)
Abdulla Omaruddin
import turtle
def square (length, angle):
my_turtle = turtle.Turtle ()
my_turtle.forward (length)
my_turtle.left (angle)
my_turtle.forward (length)
my_turtle.left (angle)
my_turtle.forward (length)
my_turtle.left (angle)
my_turtle.forward (length)
my_turtle.forward (length)
my_turtle.left (angle)
my_turtle.forward (length)
my_turtle.left (angle)
my_turtle.forward (length)
my_turtle.left (angle)
my_turtle.forward (length)
my_turtle.left (angle)

square (100, 60)
Anidhito Irmandharu
import turtle

Avant = turtle.Turtle()

def square(xlength ,turn):
Avant.forward(xlength)
Avant.right(turn)
Avant.forward(xlength)
Avant.right(turn)
Avant.forward(xlength)
Avant.right(turn)
Avant.forward(xlength)

# This is A Single
# Flower Petal

square(200 ,90)
Avant.right(120)
square(150 ,90)
Avant.right(120)

#-----------------

square(200 ,90)
Avant.right(120)
square(150 ,90)
Avant.right(120)

square(200 ,90)
Avant.right(120)
square(150 ,90)
Avant.right(120)

square(200 ,90)
Avant.right(120)
square(150 ,90)
Avant.right(120)

square(200 ,90)
Avant.right(120)
square(150 ,90)
Avant.right(120)

square(200 ,90)
Avant.right(120)
square(150 ,90)
Avant.right(120)


it look like a flower to be honest heheh
kenneth
the shape not quiet nice
try this

import turtle

squareCircle=turtle.Turtle()
squareCircle.speed(250)
def circles(length,angle,new):
squareCircle.forward(length)
squareCircle.right(angle)
squareCircle.forward(length)
squareCircle.right(angle)
squareCircle.forward(length)
squareCircle.right(angle)
squareCircle.forward(length)
squareCircle.right(new)
squareCircle.pencolor("green")
for i in range(25):
circles(90,90,104.5)



import turtle
squareCircle=turtle.Turtle()
squareCircle.speed(250)
def circles(length,angle,angles,new):
squareCircle.forward(length)
squareCircle.right(angle)
squareCircle.forward(length)
squareCircle.right(angles)
squareCircle.forward(length)
squareCircle.left(angle)
squareCircle.forward(length)
squareCircle.right(new)
squareCircle.pencolor("blue")
for i in range(25):
circles(90,90,180,194.5)
kenneth
import turtle
flag=turtle.Turtle()
flag.speed(250)

#forming the borders

flag.pensize(2)
flag.color("black")
flag.setposition(0, 0)
flag.left(90)
flag.forward(140)
flag.right(90)
flag.forward(250)
flag.right(90)
flag.forward(260)
flag.right(90)
flag.forward(400)
flag.right(90)
flag.forward(260)
flag.right(90)
flag.forward(150)
flag.right(90)
flag.forward(140)
flag.right(90)
flag.forward(150)
flag.right(180)
flag.penup()

#function to generate red rectangles and blue block
def part(long,width,angle):
flag.pendown()
flag.begin_fill()
flag.forward(long)
flag.right(angle)
flag.forward(width)
flag.right(angle)
flag.forward(long)
flag.right(angle)
flag.forward(width)
flag.end_fill()
flag.right(angle)
flag.penup()
flag.setposition(-150,140)
flag.color("blue")
part(150,140,90)
y=140
while(y>0):
x=2
flag.setposition(2,y)
flag.color("red")
part(248,20,90)
y -=40
y= -20
while(y>-110):
x=2
flag.setposition(-150,y)
flag.color("red")
part(400,20,90)
y -=40

#function to generate each star

def star(length,left,right):
flag.right(right)
flag.forward(length)
flag.left(left)
flag.forward(length)

# function to generate row of stars

def draw_rowofstars():
y=124
while(y>10):
x= -130
for n in range(7):
flag.setposition(x,y)
flag.pensize(1)
flag.pendown()
flag.begin_fill()
flag.color("white")
for i in range(5):
star(5,72,144)
flag.end_fill()
flag.penup()
x +=20
y -= 22

draw_rowofstars()
flag.hideturtle()
This comment has been removed
Mousa Tams
I Like your Style
Rafeh Qazi
haha you guys!!
Jordan
Smooth my man, Smooth XD
Jasper Oh
import turtle
jasper=turtle.Turtle()
jasper.speed(100)
def square(lenght,angle):
for i in range(4):
jasper.forward(lenght)
jasper.left(angle)
square(50,90)
Diwaker Thakur
import turtle
my_turtle = turtle.Turtle()

def tringle(length, angle):
my_turtle.forward(length)
my_turtle.left(angle)
my_turtle.forward(length)
my_turtle.left(angle)
my_turtle.forward(length)
my_turtle.left(angle)
my_turtle.forward(length)
my_turtle.left(angle)
my_turtle.forward(length)
my_turtle.left(angle)
my_turtle.forward(length)
tringle(100, 60)
Anthony Davis
https://repl.it/EvOS/3
Robert Spina
import turtle

my_turtle = turtle.Turtle()
def square(length, angle):
my_turtle.forward(length)
my_turtle.right(angle)
my_turtle.forward(length)
my_turtle.right(angle)
my_turtle.forward(length)
my_turtle.right(angle)
my_turtle.forward(length)



square(60, 120)
my_turtle.forward(10)
square(50, 120)
my_turtle.forward(10)
square(60, 120)
my_turtle.forward(10)
Arshad
Greetings,
We reading an article and it said that Pyton 3 is not good to learn. If you want to learn learn Python 2.
How true is that?
Thank you.
Rafeh Qazi
Not true at all!
Rafeh Qazi
Not true at all. The only thing is that more tutorials cover Python 2 because it has been out longer than Python 3. However, everyone is switching to Python 3 now so it is better to think about the future and learn Python 3. Also, there are only a few basic differences for beginners.

Python 2
print 'banana'


Python 3
print('banana')


Not putting parenthesis after print is what throws many beginners off.
Ze At
the python which i installed on my windows does not enable editting
hanny-awamleh
yeah me to