Python Program with function and arguments
Q: Write a python assignment Write a python assignment program that displays HELLO using turtle graphics
Solution
import turtle
def drawH():
draw.left(90)
draw.forward(70)
draw.penup()
draw.goto(0, 35)
draw.pendown()
draw.right(90)
draw.forward(30)
draw.penup()
draw.goto(30, 70)
draw.pendown()
draw.right(90)
draw.forward(70)
def drawE():
draw.penup()
draw.goto(40, 0)
draw.pendown()
draw.right(180)
draw.forward(70)
draw.right(90)
draw.forward(35)
draw.penup()
draw.goto(40, 35)
draw.pendown()
draw.forward(35)
draw.penup()
draw.goto(40, 0)
draw.pendown()
draw.forward(35)
def drawL(cnt):
draw.penup()
if cnt==1:
draw.goto(90, 140)
else:
draw.goto(170, 140)
draw.pendown()
draw.right(90)
draw.forward(140)
draw.left(90)
draw.forward(70)
def drawO():
draw.penup()
draw.goto(280, 70)
draw.pendown()
for i in range(25):
draw.right(15)
draw.forward(10)
if __name__ == "__main__":
#set screen
frame = turtle.Screen().bgcolor("White")
draw = turtle.Turtle()
#set width and speed of the pen
draw.width(3)
draw.speed(1)
#start drawing HELLO
drawH()
drawE()
drawL(1)
drawL(2)
drawO()
Similar Samples
Visit ProgrammingHomeworkHelp.com to explore our diverse collection of programming homework samples. Our examples cover a wide range of languages including Java, Python, and C++, demonstrating our proficiency in delivering high-quality solutions. Whether you're struggling with algorithms, data structures, or software development projects, our samples illustrate how we can assist you in achieving academic success. Discover tailored solutions to your programming challenges today
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python