风火轮编程的考试题目:圆内等腰直角三角形turtle作图

风火轮编程的考试题目:圆内等腰直角三角形turtle作图

编写程序画出以下图形,包括直角坐标系,圆半径是50,三角形ABC是等腰直角三角形,AB平行x轴。

python turtle 几何圆内等腰三角形

python turtle 几何圆内等腰三角形


以下是参考代码:

import turtle

turtle.fd(300);turtle.stamp();turtle.bk(600);turtle.fd(300);turtle.left(90)
turtle.fd(300);turtle.stamp();turtle.bk(600);turtle.fd(300);turtle.right(90)

r = 100
turtle.pensize(2)
turtle.penup()

turtle.fd(r)
turtle.left(90)
turtle.pendown()
turtle.circle(r)
turtle.penup()

turtle.circle(r,45)
C = turtle.position()
turtle.dot(10,'blue')

turtle.circle(r,-90)
B = turtle.position()
turtle.dot(10,'red')

turtle.circle(r,-90)
A = turtle.position()
turtle.dot(10,'green')

turtle.pendown()
turtle.goto(C);turtle.goto(B);turtle.goto(A)

turtle.ht()
turtle.done()

李兴球

李兴球的博客是Python创意编程原创博客