Dhanuj Discovey
Dhanuj Discovey
import turtle
s=turtle.Screen()
s.bgcolor('blue')
t=turtle.Turtle()
t.speed(0)
carbon_emmision_value_list = []
def base():
t.penup()
t.goto(-90,150)
t.write('CARBON EMISSION',align='centre',font=('ariel',15))
t.goto(-120,+100)
t.pendown()
t.fillcolor('white')
t.begin_fill()
t.forward(250)
t.right(90)
t.end_fill()
t.forward(125)
t.right(90)
t.fd(250)
t.right(180)
t.fd(125)
t.left(90)
t.fd(125)
t.right(180)
t.fd(250)
base()
def car(c,x,y):
t.penup()
t.goto(x,y)
t.pendown()
a=0
initial_x = x
initial_y = y
for i in range(c):
t.right(90)
t.fd(10)
t.left(90)
for i in range(3):
t.fd(10)
t.left(90)
t.left(90)
t.fd(10)
t.left(90)
t.fd(10)
t.right(90)
t.fd(20)
t.right(90)
t.fd(20)
t.right(90)
t.fd(20)
t.fd(10)
t.dot(8)
t.backward(30)
t.dot(8)
t.right(90)
a += 1
if a < 3:
x += 40
elif a >= 3:
x = -110
y -= 35
t.penup()
t.goto(x, y)
a=0
t.penup()
t.goto(x, y)
t.pendown()
t.right(90)
else:
def bulb(b,x,y):
t.penup()
t.goto(x,y)
t.pendown()
a=0
initial_x = x
initial_y = y
t.left(90)
for i in range(b):
t.color('black')
t.width(8)
t.fd(20)
t.color('yellow')
t.dot(30)
a += 1
if a < 3:
x += 40
elif a >= 3:
x = 25
y -= 40
t.penup()
t.goto(x, y)
a=0
t.penup()
t.goto(x, y)
t.pendown()
else:
def carrot(cr,x,y):
t.penup()
t.goto(x,y)
t.pendown()
a=0
initial_x = x
initial_y = y
t.right(90)
for i in range(cr):
t.color('green')
t.right(45)
t.fd(10)
t.left(90)
t.fd(10)
t.backward(10)
t.right(45)
t.color('orange')
t.begin_fill()
t.fd(10)
t.right(135)
t.fd(15)
t.right(90)
t.fd(15)
t.right(135)
t.fd(10)
t.end_fill()
a += 1
if a < 3:
x += 45
elif a >= 3:
x = -110
y -= 40
t.penup()
t.goto(x, y)
a=0
t.penup()
t.goto(x, y)
t.pendown()
else:
t.penup()
t.goto(x, y)
t.pendown()
a=0
initial_x = x
initial_y = y
t.begin_fill()
for i in range(fishy):
t.color('grey')
for i in range(2):
t.fd(10)
t.right(45)
t.fd(10)
t.right(90)
t.fd(10)
t.right(45)
t.fd(10)
t.fd(10)
t.right(45)
t.fd(20)
t.left(120)
t.fd(10)
t.left(120)
t.fd(10)
t.right(50)
t.fd(10)
t.left(45)
t.fd(18)
t.end_fill()
t.color('yellow')
t.dot(5)
t.right(190)
a += 1
if a < 3:
x += 40
elif a >= 3:
x = 25
y -= 40
a=0
t.penup( )
t.goto(x, y)
t.pendown()
total = 0
for i in carbon_emmision_value_list:
total += i
print("----------------------------------------------------------------------")
print("| The amount of carbon emmited by", carr , "Km", "vehicles is:",
transport_emission_factor, "kg CO2e |")
print("| The amount of carbon emmited by consuming", carro , "veg meals is:",
veg_meal_factor, "kg CO2e |")
print("| The amount of carbon emmited by consuming", fishy , "non-veg meals is:",
non_veg_meal_factor, "kg CO2e |")
print("----------------------------------------------------------------------")