# Demo entry 6775410

turtle city skyline

Submitted by anonymous on Nov 24, 2018 at 07:49
Language: Python 3. Code size: 4.5 kB.

```import turtle

turtle.bgcolor("#eef2ff")
turtle.setup(420, 600)

def teleport(x, y):
turtle.hideturtle()
turtle.pu()
turtle.goto(x, y)
turtle.pd()
turtle.showturtle()

def curve():
turtle.left(45)
turtle.forward(5)
turtle.left(45)

def snowCircle(size):
# Redefine the line and fill colors
turtle.pencolor("#33cccc")
turtle.fillcolor("white")
# Draw the snow circle
turtle.begin_fill()
turtle.circle(size)
turtle.end_fill()

def drawBase(x, y):
# Remember the original colors
oldColor = turtle.pencolor()
oldFillColor = turtle.fillcolor()
# Reposition the turtle
teleport(x, y)
snowCircle(100)
# Restore the original colors
turtle.fillcolor(oldFillColor)
turtle.pencolor(oldColor)

def drawMidSection(x, y):
# Remember the original colors
oldColor = turtle.pencolor()
oldFillColor = turtle.fillcolor()
# Reposition the turtle
teleport(x, y)
snowCircle(68)
# Restore the original colors
turtle.fillcolor(oldFillColor)
turtle.pencolor(oldColor)

def drawArms(leftX, leftY, rightX, rightY):
# Remember the original color
oldColor = turtle.pencolor()
# Redefine the line color
turtle.pencolor("#331a00")
# Reposition the turtle
teleport(leftX, leftY)
# Draw left arm
turtle.left(170)
turtle.forward(50)
turtle.right(50)
turtle.forward(35)
turtle.right(20)
turtle.forward(12)
turtle.backward(12)
turtle.left(60)
turtle.forward(12)
# Reposition the turtle
teleport(rightX, rightY)
# Draw right arm
turtle.right(130)
turtle.forward(80)
turtle.right(50)
turtle.forward(15)
turtle.backward(15)
turtle.left(100)
turtle.forward(15)
turtle.right(78)
# Restore the original color
turtle.pencolor(oldColor)

# Remember the original colors
oldPenColor  = turtle.pencolor()
oldFillColor = turtle.fillcolor()
# Reposition the turtle
teleport(x, y)
snowCircle(42)
# Draw the smile
teleport(x-21, y+27)
# Redefine the line color
turtle.pencolor("black")
# Draw the smile
turtle.right(90)
turtle.circle(20, 180)
teleport(x+17, y+34)
# Redefine the line and fill colors
turtle.pencolor("#b36b00")
turtle.fillcolor("#ff9900")
# Draw the carrot nose
turtle.begin_fill()
turtle.left(60)
turtle.forward(21)
turtle.left(120)
turtle.forward(11)
turtle.left(90)
turtle.forward(21)
turtle.end_fill()
# Redefine the line color
turtle.pencolor("black")
# Reposition the turtle
teleport(x-16, y+56)
# Draw the left coal eye
turtle.dot(10)
# Reposition the turtle
teleport(x+16, y+56)
# Draw the right coal eye
turtle.dot(10)
# Restore the original colors
turtle.pencolor(oldPenColor)
turtle.fillcolor(oldFillColor)
turtle.right(2)

def drawHat(x, y):
# Remember the original colors
oldPenColor  = turtle.pencolor()
oldFillColor = turtle.fillcolor()
# Reposition the turtle
teleport(x-50, y)
# Redefine the line and fill colors
turtle.pencolor("black")
turtle.fillcolor("black")
# Draw the hat
turtle.begin_fill()
turtle.forward(100)
turtle.pencolor(oldPenColor)
turtle.fillcolor(oldFillColor)
curve()
turtle.forward(15)
curve()
turtle.forward(25)
turtle.right(90)
turtle.forward(50)
curve()
turtle.forward(45)
curve()
turtle.forward(50)
turtle.right(90)
turtle.forward(25)
curve()
turtle.forward(15)
curve()
turtle.forward(2)
turtle.end_fill()
# Restore the original colors
turtle.pencolor(oldPenColor)
turtle.fillcolor(oldFillColor)

def drawSnowMan(x, y, lineWidth):
# Remember the original line width
oldLineWidth = turtle.width
# Redefine the line width
turtle.width(lineWidth)
# Draw the base
drawBase(x, y-250)
# Draw the middle section
drawMidSection(x, y-51)
# Draw the branch arms
drawArms(x-69, y+22, x+68, y+27)