猫史档案馆


【Python作品分享】五洲大挑战【作品秀】

用户:飞蓬景天飞蓬景天查看:0 回复:0 评论:0 创建时间:2020-10-08T08:56:41


【作品展示】

center_image

 

【作品介绍】

作者很聪明,不想跟你说话

 

【作品源代码】

# 大洋大洲1492
import turtle
# 画笔初始化
turtle.setup(800,600)
myPen = turtle.Pen()
myPen.pensize(5)
# 矩形 700*500
def rectangle():
    myPen.penup()
    myPen.goto(-350,-250)
    myPen.pendown()
    for __count in range(2):
        myPen.forward(700)
        myPen.left(90)
        myPen.forward(500)
        myPen.left(90)
# 赤道
def equator():
    myPen.penup()
    myPen.goto(-350,0)
    myPen.pendown()
    myPen.forward(700)
    myPen.write('赤道',font = ('Arial',14,'normal'))

def meridian():
    myPen.penup()
    myPen.goto(-280,250)
    myPen.pendown()
    myPen.setheading(270)
    myPen.forward(500)
    myPen.write('0度经线',font = ('Arial',14,'normal'))
    myPen.penup()
    myPen.goto(100,250)
    myPen.pendown()
    myPen.setheading(270)
    myPen.forward(500)
    myPen.write('180度经线', font=('Arial', 14, 'normal'))

def Map():
    myPen.pencolor('red')
    rectangle()
    equator()
    meridian()
# 经线 0度经线x坐标为-280,180度经线x坐标为100

# 南美洲 坐标:(180,20)、(250,-150)、(300,-20)
def Southamerica():
    myPen.penup()
    myPen.goto(180,20)
    myPen.pendown()
    myPen.goto(250,-150)
    myPen.goto(300,-20)
    myPen.goto(180,20)
    name(230,-70,'南美洲')
# 北美 坐标:(110,200)、(330,200)、(180,20)
def Northamerica():
    myPen.penup()
    myPen.goto(110,200)
    myPen.pendown()
    myPen.goto(330,200)
    myPen.goto(180,20)
    myPen.goto(110,200)
    name(180,120,'北美洲')
# 亚洲 坐标:(-250,200)、(-150,-30)、(110,200)
def Asia():
    myPen.penup()
    myPen.goto(-250, 200)
    myPen.pendown()
    myPen.goto(-150,-30)
    myPen.goto(110, 200)
    myPen.goto(-250, 200)
    name(-150,100,'亚洲')
# 欧洲 坐标:(-250,200)、(-320,110)、(-210,110)
def Europe():
    myPen.penup()
    myPen.goto((-250), 200)
    myPen.pendown()
    myPen.goto(-320, 110)
    myPen.goto(-210, 110)
    myPen.goto(-250, 200)
    name(-270, 120, '欧洲')
# 非洲 坐标:(-210,70)、(-330,70)、(-260,-80)
def Africa():
    myPen.penup()
    myPen.goto(-210, 70)
    myPen.pendown()
    myPen.goto(-330, 70)
    myPen.goto(-260, (-80))
    myPen.goto(-210, 70)
    name(-260,20,'非洲')
# 大洋洲 坐标:(-145,-150)def Africa():
def Oceania():
    myPen.penup()
    myPen.goto(-145, -150)
    myPen.setheading(0)
    myPen.pendown()
    for __count in range(3):
        myPen.forward(100)
        myPen.left(120)
    name(-110,-180,'大洋洲')
# 打印洲名
def name(x,y,z):
    myPen.penup()
    myPen.goto(x,y)
    myPen.write(z,font = ('Arial',14,'normal'))

begin = input('五洲大挑战,叫你一声你敢答应吗?(Y/N)')
while begin=='y':
    Map()
    myPen.pencolor('black')
    asia = input('东西距离最长的大洲是?')
    if asia == '亚洲':
        Asia()
    europe = input('被古希腊人称为西方日落之地的大洲?')
    if europe == '欧洲':
        Europe()
    northamerica = input('最大的岛屿格陵兰岛位于哪个洲?')
    if northamerica == '北美洲':
        Northamerica()
    southamerica = input('被人们称为地球之肺的亚马逊雨林位于哪个洲?')
    if southamerica == '南美洲':
        Southamerica()
    africa = input('被赤道横穿的大洲是?')
    if africa == '非洲':
        Africa()
    oceania = input('世界上最小的大洲是?')
    if oceania == '大洋洲':
        Oceania()

    begin = input('再画一次!(Y/N)')
    myPen.clear()
# 主体程序从这里开始

turtle.done()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页