Docsity

CodeHS Unit 2: Programming Exercises and Solutions (2023), Exams of Nursing

Toggle sidebar
bg1
All Code HS codes unit 2 Latest 2023
Graded A+
2.1.4 stretched slinky ✔✔circle(35)
forward(40)
circle(35)
forward(40)
circle(35)
forward(40)
circle(35)
forward(40)
circle(35)
forward(40)
2.2.4 shorter dashed line ✔✔penup()
backward(200)
pendown()
forward(50)
penup()
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27

Partial preview of the text

Download CodeHS Unit 2: Programming Exercises and Solutions (2023) and more Exams Nursing in PDF only on Docsity!

All Code HS codes unit 2 Latest 2023

Graded A+

2.1.4 stretched slinky ✔✔circle(35) forward(40) circle(35) forward(40) circle(35) forward(40) circle(35) forward(40) circle(35) forward(40) 2.2.4 shorter dashed line ✔✔penup() backward(200) pendown() forward(50) penup()

forward(50) pendown() forward(50) penup() forward(50) pendown() forward(50) penup() forward(50) pendown() forward(50) penup() forward(50) 2.2.5 caterpillar ✔✔circle(20) penup() forward(40) pendown()

forward(50) left(90) forward(100) left(90) 2.3.6 4 columns ✔✔penup() left(90) forward(200) right(90) right(90) pendown() forward(400) penup() right(90) forward(100) pendown() right(90) forward(400)

right(90) penup() forward(200) pendown() right(90) forward(400) 2.4.5 row of circles ✔✔speed(0) penup() backward(200) pendown() forward(10) for i in range(20): circle(10) penup() forward(20) pendown()

pendown() forward(400) 2.5.5 hexagon ✔✔speed(0) for i in range(6): forward(50) left(60) 2.5.6 x marks the spot ✔✔speed(0) left(45) for i in range(4): forward(100) backward(100) left(90) 2.5.7 circle pyramid ✔✔speed(0) penup() setposition(-100,-200)

for i in range (3): pendown() circle(50) penup() forward(100) setposition(-50,-100) for i in range (2): pendown() circle(50) penup() forward(100) pendown() penup() setposition(0,0) pendown() circle(50) penup() forward(100)

pendown() circle(50) penup() forward(100) #top circle setposition(0,0) pendown() circle(50) penup() forward(100) 2.8.4 beaded bracelet ✔✔speed(0) """ there must be 36 beads, a radius of 10 pixles, and the braclet must have a diameter of 200. use a function and turn tracy 10 degrees after drawing and return to the middle of each bead. """ speed(0)

def draw_beaded_braclet(): for i in range(36): penup() forward(100) pendown() circle(10) penup() backward(100) left(10) draw_beaded_braclet() 2.8.5 shape stack ✔✔""" this code will draw a stack of four squars and four cirlces alternating from top to bottom """ speed(0) #this function will draw a squrae and then and then movs to the position to draw the circle def draw_square():

#tracy is to start position and then starts drawing circles and squares alternating penup() setposition(-25,-200) for i in range(4): draw_circle() draw_square() 2.9.5 four colored triangles ✔✔speed(0) pensize(5) color("red") backward(100) forward(200) backward(200) left(45) for i in range(4): color("green") forward(50) right(90)

color("blue") forward(50) 2.9.6 colorful bracelet ✔✔speed(0) def draw_colored_braclet(): for i in range(12): penup() color("purple") forward(100) pendown() begin_fill() circle(10) end_fill() penup() backward(100) left(10) penup() color("blue")

draw_colored_braclet() 2.10.4 bubble wrap 2.0 ✔✔""" This code will fill the canvas with light blue circles. Now add a function that will draw a white highlight on each bubble. """ speed(0)

This function will draw one row of 10 circles

def draw_circle_row(): for i in range(10): pendown() begin_fill() color("light blue") circle(20) end_fill() penup() forward(40)

This function will move Tracy from end of row up to beginning of the row on top

def move_up_a_row(): left(90) forward(40) right(90) backward(400)

Send Tracy to starting position in bottom left corner

penup() setposition(-180,-200)

Call circle drawing function 10 times to fill ten rows

for i in range(10): draw_circle_row() move_up_a_row() 2.10.5 sidewalk ✔✔speed(0) def line_of_squares(): for i in range(8): pendown()

2.11.4 dartboard ✔✔speed(0) radius= penup() setposition(0,-25) def move_down(): penup() right(90) forward(25) left(90) pendown() for i in range(4): move_down() circle(radius) radius=radius+ 2.11.5 line of increasing blocks ✔✔speed(3) size=

def make_square(): for i in range(4): pendown() forward(size) left(90) setposition(-150,0) for i in range(5): make_square() penup() forward(2*size) size=size+ 2.12.4 colorful dartboard ✔✔radius= for i in range(4): penup() setposition(0,0) right(90) forward(radius)