0% found this document useful (0 votes)
42 views3 pages

Text C

The document defines functions to draw different letters and shapes using the turtle module in Python. It defines functions like rect(), four_corner_lines(), p(), u(), b(), and g() to draw a rectangle, lines at the four corners, and the letters P, U, B, and G respectively. It then calls these functions to draw the letters PUBG.

Uploaded by

Dilpreet Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views3 pages

Text C

The document defines functions to draw different letters and shapes using the turtle module in Python. It defines functions like rect(), four_corner_lines(), p(), u(), b(), and g() to draw a rectangle, lines at the four corners, and the letters P, U, B, and G respectively. It then calls these functions to draw the letters PUBG.

Uploaded by

Dilpreet Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

import turtle

pubg = turtle.Turtle()
turtle.bgcolor("black")
pubg.color("orange")
#pubg.speed(0)

def rect(): # length 340 # breadh 182


    pubg.pensize(9)
    pubg.forward(170)
    pubg.left(45)
    pubg.forward(6)
    pubg.left(45)
    pubg.forward(170)
    pubg.left(45)
    pubg.forward(6)
    pubg.left(45)
    pubg.forward(330)
    pubg.left(45)
    pubg.forward(6)
    pubg.left(45)
    pubg.forward(170)
    pubg.left(45)
    pubg.forward(6)
    pubg.left(45)
    pubg.forward(170)

def four_corner_lines():
    pubg.pensize(12)
    pubg.penup()
    pubg.forward(180)
    pubg.left(90)
    pubg.forward(35)
    pubg.left(90)
    pubg.pendown()
    pubg.forward(12)
    pubg.penup()
    pubg.forward(344)
    pubg.pendown()
    pubg.forward(17)
    pubg.penup()
    pubg.right(90)
    pubg.forward(105)
    pubg.right(90)
    pubg.pendown()
    pubg.forward(17)
    pubg.penup()
    pubg.forward(344)
    pubg.pendown()
    pubg.forward(12)

def p(): #draw  p alphabet 


    pubg.penup()
    pubg.left(180)
    pubg.forward(280)
    pubg.pendown()
    pubg.forward(40)
    pubg.left(90)
    pubg.forward(100)
    pubg.left(180)
    pubg.forward(52)
    pubg.right(90)
    pubg.forward(40)
    pubg.left(90)
    pubg.forward(47)

def u():#draw u alphabet


    pubg.penup()
    pubg.right(90)
    pubg.forward(32)
    pubg.right(90)
    pubg.pendown()
    pubg.forward(98)
    pubg.left(90)
    pubg.forward(40)
    pubg.left(90)
    pubg.forward(98)

def b(): #draw b alphabet


    pubg.penup()
    pubg.right(90)
    pubg.forward(35)
    pubg.pendown()
    pubg.forward(45)
    pubg.right(90)
    pubg.forward(43)
    pubg.right(45)
    pubg.forward(5)
    pubg.right(45)
    pubg.forward(40)
    pubg.left(90)
    pubg.forward(5)
    pubg.left(90)
    pubg.forward(40)
    pubg.right(45)
    pubg.forward(5)
    pubg.right(45)
    pubg.forward(40)
    pubg.right(90)
    pubg.forward(45)
    pubg.right(90)
    pubg.forward(96)

def g():#draw g 
    pubg.penup()
    pubg.right(180)
    pubg.forward(53)
    pubg.left(90)
    pubg.forward(98)
    pubg.pendown()
    pubg.forward(25)
    pubg.right(90)
    pubg.forward(45)
    pubg.right(90)
    pubg.forward(45)
    pubg.right(90)
    pubg.forward(95)
    pubg.right(90)
    pubg.forward(40)    

# calling all functions


rect()
four_corner_lines()
p()
u()
b()
g()

turtle.done()

You might also like