0% found this document useful (0 votes)
13 views16 pages

Dhanuj Og

nnnnnn\\\\\\\\\

Uploaded by

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

Dhanuj Og

nnnnnn\\\\\\\\\

Uploaded by

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

Turle Infographics on Carbon Footprint

import turtle

t = turtle.Turtle()

t.speed(0)

carbon_emmision_value_list = []

screen = turtle.Screen()

screen.bgcolor('#151830')

t.penup()

t.goto(0, 120)

t.pendown()
def heading():

t.color('white')

t.write('CARBON FOOTPRINT', align="center", font=('Britannic Bold', 12))

heading()

t.penup()

t.goto(-150, 100)

t.pendown()

def sub_heading_design(length, breadth):

for i in range(2):

t.forward(breadth)

t.right(90)

t.forward(length)

t.right(90)

t.begin_fill()

sub_heading_design(50, 300)

t.end_fill()

t.color('#0f1063')

t.penup()

t.goto(-140, 90)

t.pendown()

t.begin_fill()

sub_heading_design(30, 280)
t.end_fill()

t.penup()

t.goto(0, 69)

t.pendown()

t.color('white')

t.write('CARBON EMMISION', align="center", font=('Britannic Bold', 15))

t.penup()

t.goto(-120, 40)

t.pendown()

t.begin_fill()

sub_heading_design(220, 240)

t.end_fill()

def squares(color, breadth, length):

t.color(color)

t.begin_fill()

sub_heading_design(breadth, length)

t.end_fill()

#square1

t.penup()

t.goto(-120.5, 40.5)

t.pendown()

squares('#ac2432', 110, 117)


#square2

t.penup()

t.goto(4.4, 40.5)

t.pendown()

squares('#773886', 110, 117)

#square3

t.penup()

t.goto(-120.5, -76.4)

t.pendown()

squares('#798553', 105, 117)

#square4

t.penup()

t.goto(4.3, -76.4)

t.pendown()

squares('#024947', 105, 117)

def aeroplane(aero, x, y):

t.penup()

t.goto(x, y)

a=0

initial_x = x

initial_y = y

for i in range(aero):

t.color('black')
t.begin_fill()

t.left(45)

t.forward(7.5)

t.left(105)

t.forward(11.25)

t.right(105)

t.forward(3.75)

t.right(60)

t.forward(10)

t.penup()

t.goto(x, y)

t.left(15)

t.right(45)

t.forward(5)

t.pendown()

t.left(90)

t.forward(7.5)

t.right(90)

t.forward(11.25)

t.left(90)

t.forward(3.75)

t.left(75)

t.forward(10)

t.right(45)

t.forward(5)

t.right(15)

t.forward(5)
t.left(15)

t.forward(5)

t.left(130)

t.forward(3.75)

t.left(20)

t.forward(6.25)

t.right(15)

t.forward(4)

t.penup()

t.goto(x, y)

t.right(210)

t.left(175)

t.pendown()

t.forward(5)

t.left(50)

t.forward(5)

t.left(135)

t.forward(7.5)

t.right(35)

t.forward(3.25)

t.right(45)

t.forward(6.25)

t.left(130)

t.forward(5)

t.left(50)

t.forward(5)

t.end_fill()

t.right(10)
a += 1

if a < 3:

x += 35

y -= 1

elif a >= 3:

x = -104

y -= 35

t.penup()

t.goto(x, y)

a=0

t.penup()

t.goto(x, y)

t.pendown()

t.right(90)

aero = int(input("Enter the distance travelled in kilometers. (Between 10 - 90 KMS): "))

if aero <= 90 and aero >= 10:

aeroplane(aero//10, -104, 17)

elif aero > 90 or aero < 10:

while True:

print("Invalid: Value Greater than 90 or Less than 10")

aero = int(input("Enter the distance travelled in kilometers. (Between 10 -


90 KMS): "))

if aero <= 90 and aero >= 10:

aeroplane(aero//10, -104, 17)

break
transport_emission_factor = aero * 0.21

carbon_emmision_value_list.append(transport_emission_factor)

def electricity(elec, x, y):

t.penup()

t.goto(x, y)

a=0

initial_x = x

initial_y = y

for i in range(elec):

t.color('# e700')

t.begin_fill()

t.left(180)

t.forward(2.5)

t.right(180)

t.left(50)

t.forward(16.6)

t.right(160)

t.forward(14.16)

t.left(110)

t.forward(2.5)

t.right(130)

t.forward(16.6)

t.right(160)

t.forward(14.16)

t.end_fill()
t.right(75)

t.color('#8ecc20')

t.penup()

t.forward(19)

t.left(90)

t.width(1.5)

t.pendown()

t.circle(16.6)

t.ht()

a += 1

if a < 3:

x += 35

y -= 1

elif a >= 3:

x = 25

y -= 30

t.penup()

t.goto(x, y)

a=0

t.penup()

t.goto(x, y)

t.pendown()

t.right(85)

elec = int(input("Enter the number devices used (Between 1 - 9 Devices): "))

if elec <= 9 and elec >= 1:

electricity(elec, 25, 20)


elif elec > 9 or elec < 1:

while True:

print("Invalid: Enter a value less than 9 and greater than 1")

elec = int(input("Enter the number devices used (Between 1 - 9 Devices):


"))

if elec <= 9 and elec >= 1:

electricity(elec//1, 25, 20)

break

device_emission_factor = elec * 0.05

carbon_emmision_value_list.append(device_emission_factor)

def vegetarian(veg, x, y):

t.penup()

t.goto(x, y)

a=0

t.pendown()

t.left(90)

for i in range(veg):

def curved_square(size):

for i in range(4):

t.forward(size)

t.circle(-6, 90)

t.color('#079635')

t.begin_fill()
curved_square(20)

t.end_fill()

t.penup()

t.goto(x + 2, y + 2)

t.pendown()

t.color('white')

t.begin_fill()

curved_square(16)

t.end_fill()

t.penup()

t.goto(x + 16, y + 10)

t.pendown()

t.color('#049834')

t.dot(18)

t.color('white')

t.penup()

t.backward(2)

t.write("VEG", align='center', font=('Aptos', 5))

t.ht()

a += 1

if a < 3:

x += 35
y -= 0

elif a >= 3:

x = -112.5

y -= 35

t.penup()

t.goto(x, y)

a=0

t.penup()

t.goto(x, y)

t.pendown()

t.right(90)

veg = int(input("Enter the amount of veg meals consumed (Between 1 - 9 Veg Meals):"))

if veg >= 1 and veg <= 9:

vegetarian(veg//1, -113, -104)

elif veg < 1 or veg > 9:

while True:

print("Invalid: Enter a value less than 9 and greater than 1")

veg = int(input("Enter the amount of veg meals consumed :"))

if veg >= 1 and veg <= 9:

vegetarian(veg//1, -113, -104)

break

veg_meal_factor = veg * 0.002

carbon_emmision_value_list.append(veg_meal_factor)
def non_vegetarian(non, x, y):

t.penup()

t.goto(x, y)

a=0

for i in range(non):

t.color('#ec5f5f')

t.dot(31.25)

t.color('white')

t.penup()

t.goto(x - 7.3, y - 10.5)

t.begin_fill()

t.pendown()

t.forward(15.624)

t.left(45)

t.forward(3.25)

t.left(135)

t.forward(20.416)

t.left(135)

t.forward(3.125)

t.end_fill()

t.penup()

t.begin_fill()

t.left(180)

t.goto(x - 6, y - 12)

t.pendown()

t.forward(5.2)
t.circle(-4, 100)

t.forward(7.8125)

t.circle(-6, 80)

t.forward(10.4)

t.right(135)

t.forward(14.58)

t.end_fill()

t.right(180)

t.penup()

t.goto(x - 0.4, y + 5)

t.write('Non-Veg', align='center', font=('Arial', 5))

a += 1

if a < 3:

x += 35

y -= 1

elif a >= 3:

x = 29

y -= 30

t.penup()

t.goto(x, y)

a=0

t.penup()

t.goto(x, y)

t.pendown()

non = int(input("Enter the amount of non-veg meals consumed (Between 1 - 9 Non-Veg


Meals):"))
if non <= 9 and non >= 1:

non_vegetarian(non//1, 28.5, -98)

elif non > 9 or non < 1:

while True:

print("Invalid: Enter a value less than or equal to 9 and greater than or


equal to 1 Non-Veg Meals")

non = int(input("Enter the amount of non-veg meals consumed :"))

if non <= 9 and non >= 1:

non_vegetarian(non//1, 28.5, -98)

break

non_veg_meal_factor = non * 0.01

carbon_emmision_value_list.append(non_veg_meal_factor)

total = 0

for i in carbon_emmision_value_list:

total += i

print("----------------------------------------------------------------------")

print("| The amount of carbon emmited by", aero , "Km", "vehicles is:",
transport_emission_factor, "kg CO2e |")

print("| The amount of carbon emmited by", elec , "devices is:", device_emission_factor,
"kg CO2e |")

print("| The amount of carbon emmited by consuming", veg , "veg meals is:",
veg_meal_factor, "kg CO2e |")

print("| The amount of carbon emmited by consuming", non , "non-veg meals is:",
non_veg_meal_factor, "kg CO2e |")

print("|", "The carbon emmited by all 4 is:", carbon_emmision_value_list, "|")


print("| The total carbon emmited is:",total)

print("----------------------------------------------------------------------")

t.done()

You might also like