The Joy of Programming
Functions
There is no preview available for this lesson. Please join the course to access it. Click here to enroll.
Questions
help me to 6.1
SINAN NOUSHAD
2 years ago
Post
Dismiss
i dont get it!
i dont get it!
U UANANDHAKRISHNAN
2 years ago
Post
Dismiss
def reddot(x, y): c = circle(x=x, y=y, r=5, fill="red",stroke='none') return c c = circle(r=50) d = reddot(x=0, y=50) show(c, d)
def reddot(x, y): c = circle(x=x, y=y, r=5, fill="red",stroke='none') return c c = circle(r=50) d = reddot(x=0, y=50) show(c, d)
Want to discuss?
Post it here, our mentors will help you out.
6.2
U UANANDHAKRISHNAN
2 years ago
Post
Dismiss
help me to code!
help me to code!
U UANANDHAKRISHNAN
2 years ago
Post
Dismiss
i got it! def square(x1,y1,x2,y2,x3,y3,x4,y4): p1=point(x1,y1) p2=point(x2,y2) p3=point(x3,y3) p4=point(x4,y4) return polygon([p1,p2,p3,p4]) s1 = square(x1=0,y1=0, x2=-100,y2=0,x3=-100, y3=-100,x4=0, y4=-100) s2 = square(x1=0,y1=0, x2=100,y2=0, x3=100,y3=100, x4=0,y4=100) show(s1, s2)
i got it! def square(x1,y1,x2,y2,x3,y3,x4,y4): p1=point(x1,y1) p2=point(x2,y2) p3=point(x3,y3) p4=point(x4,y4) return polygon([p1,p2,p3,p4]) s1 = square(x1=0,y1=0, x2=-100,y2=0,x3=-100, y3=-100,x4=0, y4=-100) s2 = square(x1=0,y1=0, x2=100,y2=0, x3=100,y3=100, x4=0,y4=100) show(s1, s2)
AK Arun Krishnadas
2 years ago
Post
Dismiss
def square(x,y,length): r=rectangle(x=x,y=y,w=length,h=length) return(r) s1 = square(x=50, y=50, length=100) s2 = square(x=-50, y=-50, length=100) show(s1, s2)
def square(x,y,length): r=rectangle(x=x,y=y,w=length,h=length) return(r) s1 = square(x=50, y=50, length=100) s2 = square(x=-50, y=-50, length=100) show(s1, s2)
Want to discuss?
Post it here, our mentors will help you out.
6.4
AR Archand Raj
2 years ago
Post
Dismiss
exercise 6.4
exercise 6.4
MS Muhammed Salih
2 years ago
Post
Dismiss
def donut(x,y,r): c = circle(x=x,y=y,r=r)+circle(x=x,y=y,r=r/2) return c show(donut(-50,50,50),donut(50,-50,50))
def donut(x,y,r): c = circle(x=x,y=y,r=r)+circle(x=x,y=y,r=r/2) return c show(donut(-50,50,50),donut(50,-50,50))
U UANANDHAKRISHNAN
2 years ago
Post
Dismiss
def donut(x,y,r): c=circle(x=x,y=y,r=r)+circle(x=x,y=y,r=r/2) return c c1=donut(x=-50,y=50,r=50) c2=donut(x=50,y=-50,r=50) show(c1,c2)
def donut(x,y,r): c=circle(x=x,y=y,r=r)+circle(x=x,y=y,r=r/2) return c c1=donut(x=-50,y=50,r=50) c2=donut(x=50,y=-50,r=50) show(c1,c2)
Jassim Saji
2 years ago
Post
Dismiss
```python def donut(x, y, r): c = circle(x=x, y=y, r=r) + circle(x=x, y=y, r=r/2) return c c1 = donut(x=-50, y=50, r=50) c2 = donut(x=50, y=-50, r=50) show(c1, c2) ```
```python def donut(x, y, r): c = circle(x=x, y=y, r=r) + circle(x=x, y=y, r=r/2) return c c1 = donut(x=-50, y=50, r=50) c2 = donut(x=50, y=-50, r=50) show(c1, c2) ```
Want to discuss?
Post it here, our mentors will help you out.
Exercise 6.3
AN Arya Nambiar
2 years ago
Post
Dismiss
Can u please help me with exercise 6.3?
Can u please help me with exercise 6.3?
JE Joswin Emmanuel
2 years ago
Post
Dismiss
# define triangle function here def triangle(x1,y1,x2,y2,x3,y3): p1=point(x1,y1) p2=point(x2,y2) p3=point(x3,y3) return polygon([p1,p2,p3]) # create and show a triangle s = triangle(x1=0, y1=0, x2=100, y2=0, x3=0, y3=100) show(s) answer for exercise 6.3
# define triangle function here def triangle(x1,y1,x2,y2,x3,y3): p1=point(x1,y1) p2=point(x2,y2) p3=point(x3,y3) return polygon([p1,p2,p3]) # create and show a triangle s = triangle(x1=0, y1=0, x2=100, y2=0, x3=0, y3=100) show(s) answer for exercise 6.3
H Harine
2 years ago
Post
Dismiss
Can u please help me with exercise 6.4?
Can u please help me with exercise 6.4?
MR Muhammed Ramshad
2 years ago
Post
Dismiss
Can u please help me with exercise 6.4?
Can u please help me with exercise 6.4?
ST Sangeeth T
2 years ago
Post
Dismiss
can you explain 6.3?
can you explain 6.3?
MN Muhammed Nabeel
2 years ago
Post
Dismiss
# define triangle function here def triangle(x1,y1,x2,y2,x3,y3): p1=point(x1,y1) p2=point(x2,y2) p3=point(x3,y3) t=polygon ([p1, p2, p3]) return t # create and show a triangle s = triangle(x1=0, y1=0, x2=100, y2=0, x3=0, y3=100) show(s) 6.3 answer
# define triangle function here def triangle(x1,y1,x2,y2,x3,y3): p1=point(x1,y1) p2=point(x2,y2) p3=point(x3,y3) t=polygon ([p1, p2, p3]) return t # create and show a triangle s = triangle(x1=0, y1=0, x2=100, y2=0, x3=0, y3=100) show(s) 6.3 answer
Jassim Saji
2 years ago
Post
Dismiss
```python # define triangle function here triangle(x1, y1, x2, y2, x3, y3): p1 = point(x1, y1) p2 = point(x2, y2) p3 = point(x3, y3) return polygon([p1, p2, p3]) # create and show a triangle s = triangle(x1=0, y1=0, x2=100, y2=0, x3=0, y3=100) show(s)
```python # define triangle function here triangle(x1, y1, x2, y2, x3, y3): p1 = point(x1, y1) p2 = point(x2, y2) p3 = point(x3, y3) return polygon([p1, p2, p3]) # create and show a triangle s = triangle(x1=0, y1=0, x2=100, y2=0, x3=0, y3=100) show(s)
Want to discuss?
Post it here, our mentors will help you out.