# 21.รูป3เหลี่ยมซ้อนLoop

<figure><img src="/files/8YPleSZzAsajhYBwduRV" alt=""><figcaption></figcaption></figure>

```python
// Some code
import turtle	        #นำเข้าโมดูล turtle เพื่อใช้ในการวาดกราฟิก
t = turtle.Turtle()	#สร้างวัตถุ turtle ชื่อ t สำหรับใช้วาดกราฟิก
t.shape('turtle')	#กำหนดรูปร่างของหัวปากกาให้เป็นรูปเต่า
t.color('blue')	        #กำหนดสีของปากกาและกราฟิกเป็นสีน้ำเงิน
t.width(2)	        #กำหนดความหนาของเส้นที่ปากกาวาดเป็น 2 หน่วย
t.speed(10)	        #กำหนดความเร็วในการวาดกราฟิกเป็นระดับ 10 (ความเร็วสูง)
for _ in range(12):	#เริ่มลูปภายนอก วนซ้ำ 12 รอบ (สร้างรูปแบบซ้ำกัน 12 ครั้ง)
    for _ in range(3):	#เริ่มลูปภายในแรก วนซ้ำ 3 รอบ (วาดรูปสามเหลี่ยมเล็ก)
        t.fd(60)	#วาดเส้นตรงไปข้างหน้า 60 หน่วย
        t.rt(120)	#หมุนหัวปากกาทางขวา 120 องศา
    for _ in range(3):	#เริ่มลูปภายในที่สอง วนซ้ำ 3 รอบ (วาดรูปสามเหลี่ยมใหญ่)
        t.fd(100)	#วาดเส้นตรงไปข้างหน้า 100 หน่วย
        t.rt(120)	#หมุนหัวปากกาทางขวา 120 องศา
    t.lt(30)	        #หมุนหัวปากกาทางซ้าย 30 องศา

```

<figure><img src="/files/HBTT3kGW6DcFCsBrXxxF" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://krootee.gitbook.io/python-turtle/3.example21-30/21.-3-loop.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
