Page 1 of 1

## 3 Replies - 6597 Views - Last Post: 18 November 2012 - 09:57 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=300583&amp;s=dbdc2f7388badfb9318b422c097aaabb&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 emma9873

Reputation: 0
• Posts: 2
• Joined: 17-November 12

Posted 17 November 2012 - 11:10 AM

```def patchDesign2():
win = GraphWin("Patchwork2", 100, 100)
p1 = Point(0, 0)
p2 = Point(10, 90)
rectangle1 = Rectangle(p1, p2)
rectangle1.draw(win)
p3 = Point(0, 100)
p4 = Point(90,90)
rectangle2 = Rectangle(p3,p4)
rectangle2.draw(win)
p5 = Point(100, 100)
p6 = Point(90, 10)
rectangle3 = Rectangle(p5, p6)
rectangle3.draw(win)
p7 = Point(10, 10)
p8 = Point(100, 0)
rectangle4 = Rectangle(p7, p8)
rectangle4.draw(win)
p9 = Point(20, 80)
p10 = Point(10, 10)
rectangle5 = Rectangle(p9, p10)
rectangle5.draw(win)
p11 = Point(80, 80)
p12 = Point(10, 90)
rectangle6 = Rectangle(p11, p12)
rectangle6.draw(win)
p13 = Point(80, 20)
p14 = Point (90, 90)
rectangle7 = Rectangle(p13,p14)
rectangle7.draw(win)
p15 = Point(20, 20)
p16 = Point(90, 10)
rectangle8 = Rectangle(p15, p16)
rectangle8.draw(win)
p17 = Point(30, 70)
p18 = Point(20, 20)
rectangle9 = Rectangle(p17, p18)
rectangle9.draw(win)
p19 = Point(70, 70)
p20 = Point(20, 80)
rectangle10 = Rectangle(p19, p20)
rectangle10.draw(win)
p21 = Point(70, 30)
p22 = Point(80, 80)
rectangle11 = Rectangle(p21, p22)
rectangle11.draw(win)
p23 = Point(30, 30)
p24 = Point(80, 20)
rectangle12 = Rectangle(p23, p24)
rectangle12.draw(win)
p25 = Point(40, 60)
p26 = Point(30, 30)
rectangle13 = Rectangle(p25, p26)
rectangle13.draw(win)
p27 = Point(60, 60)
p28 = Point(30, 70)
rectangle14 = Rectangle(p27, p28)
rectangle14.draw(win)
p29 = Point(60, 40)
p30 = Point (70, 70)
rectangle15 = Rectangle(p29, p30)
rectangle15.draw(win)
p31 = Point(40, 40)
p32 = Point(70, 30)
rectangle16 = Rectangle(p31,p32)
rectangle16.draw(win)
```

MOD EDIT: Added code tags. When posting code...ESPECIALLY Python code...USE CODE TAGS!!

/>

This post has been edited by JackOfAllTrades: 18 November 2012 - 09:56 AM

Is This A Good Question/Topic? 0

## Replies To: How can i make this rectangle design into a loop?

### #2 tlhIn`toq

• Xamarin Cert. Dev.

Reputation: 6528
• Posts: 14,439
• Joined: 02-June 10

## Re: How can i make this rectangle design into a loop?

Posted 17 November 2012 - 12:21 PM

Collections. Array for example. Instead of having 30+ individual variables of rectangle## you could make an array of them, then loop through the array.

### #3 emma9873

Reputation: 0
• Posts: 2
• Joined: 17-November 12

## Re: How can i make this rectangle design into a loop?

Posted 18 November 2012 - 03:38 AM

tlhIn`toq, on 17 November 2012 - 12:21 PM, said:

/>

Collections. Array for example. Instead of having 30+ individual variables of rectangle## you could make an array of them, then loop through the array.

I have never done an array, would it be possible to give me an example? Thanks alot

• Saucy!

Reputation: 6246
• Posts: 24,014
• Joined: 23-August 08

## Re: How can i make this rectangle design into a loop?

Posted 18 November 2012 - 09:57 AM