Session 3
Session 3
Session 3
CrEAST
Baseline Test
on Quizizz
Do you know ?
How to calculate area of Rectangle ?? length = float(input("Enter length: "))
+ Addition 5+3=8
- Subtraction 10 - 4 = 6
* Multiplication 2 * 7 = 14
b = 200
if b > a:
a = 33
b = 33
if b > a:
print("b is greater than a")
elif a == b:
print("a and b are equal")
Assignment - traffic light ( use of if else )
import turtle
t = turtle.Turtle()
t.speed(5)
color = "red"
t.penup()
if color == "red":
t.color("red")
elif color == "yellow":
t.color("yellow")
elif color == "green":
t.color("green")
t.pendown()
t.begin_fill()
t.circle(20)
t.end_fill()
Assignment part 2 - draw green circle if even and blue if odd
import turtle
t = turtle.Turtle()
t.speed(2)
for i in range(6):
if i % 2 == 0:
t.color("blue")
else:
t.color("green")
t.begin_fill()
t.circle(10) # Draw a circle with a radius of 30
t.end_fill()
t.penup()
t.forward(30)
t.pendown()
LETS try # Spinning effect
import turtle
screen = turtle.Screen() # Creating a turtle screen
screen.bgcolor("PINK")
pen = turtle.Turtle() # Creating a turtle
pen.shape("turtle")
pen.color("blue")
for i in range(36):
pen.right(10) # Rotates the turtle by 10 degrees gives # Spinning effect
turtle.done()
Thank you !!
That's it for session 3…
https://forms.gle/B9frfFTJZj3ajs639