100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

CodeHS Python | Unit 5 || BASED ON OFFICIAL EXAM FORMAT; 100% CORRECT Q&A!!

Rating
-
Sold
-
Pages
8
Grade
A+
Uploaded on
19-05-2025
Written in
2024/2025

5.1.4: Square | CodeHS correct answers # Enter your code here def square(x): double_x = 5 * x print(double_x) square(5) y = 10 square(y) 5.1.5: Triple | CodeHS correct answers # Enter your code here def triple(x): triple_x = 3 * x print(triple_x) triple(4) triple(5) y = 3 triple(y) 5.2.4: Area of Triangle | CodeHS correct answers # Enter your code here def triangle_area(BASE, HEIGHT): AREA = 1/2 * BASE * HEIGHT print(AREA) triangle_area(5, 4) triangle_area(10,1) triangle_area(6,2) 5.2.5: Height in Meters | CodeHS correct answers INCHES_TO_CM = 2.54 CM_TO_METERS = 0.01 FEET_TO_INCHES = 12 def convert_height_to_meters(feet, inches): cal_1= feet * FEET_TO_INCHES cal_2= cal_1 + inches cal_3= cal_2 * INCHES_TO_CM cal_4= cal_3 * CM_TO_METERS print(cal_4) convert_height_to_meters(6, 4) convert_height_to_meters(5, 8) convert_height_to_meters(5, 2) 5.3.4: Horizontal Lines | CodeHS correct answers # Write a function to draw a horizontal # line given a y position and a length def horizontal_line(y, length): line = Line(0 , y, length, y) _color(C) add(line)

Show more Read less
Institution
CodeHS
Course
CodeHS









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
CodeHS
Course
CodeHS

Document information

Uploaded on
May 19, 2025
Number of pages
8
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Content preview

CodeHS Python | Unit 5 || BASED ON OFFICIAL EXAM
FORMAT; 100% CORRECT Q&A!!
5.1.4: Square | CodeHS correct answers # Enter your code here
def square(x):
double_x = 5 * x
print(double_x)
square(5)

y = 10
square(y)

5.1.5: Triple | CodeHS correct answers # Enter your code here
def triple(x):
triple_x = 3 * x
print(triple_x)
triple(4)
triple(5)

y=3
triple(y)

5.2.4: Area of Triangle | CodeHS correct answers # Enter your code here
def triangle_area(BASE, HEIGHT):
AREA = 1/2 * BASE * HEIGHT
print(AREA)
triangle_area(5, 4)
triangle_area(10,1)
triangle_area(6,2)

5.2.5: Height in Meters | CodeHS correct answers INCHES_TO_CM = 2.54
CM_TO_METERS = 0.01
FEET_TO_INCHES = 12
def convert_height_to_meters(feet, inches):
cal_1= feet * FEET_TO_INCHES
cal_2= cal_1 + inches
cal_3= cal_2 * INCHES_TO_CM
cal_4= cal_3 * CM_TO_METERS
print(cal_4)
convert_height_to_meters(6, 4)
convert_height_to_meters(5, 8)
convert_height_to_meters(5, 2)

5.3.4: Horizontal Lines | CodeHS correct answers # Write a function to draw a horizontal
# line given a y position and a length
def horizontal_line(y, length):
line = Line(0 , y, length, y)
line.set_color(Color.black)
add(line)

, horizontal_line(100, 200)
horizontal_line(200, 100)
horizontal_line(300, 20)

5.3.5: Graphics Stop Light | CodeHS correct answers # This program should draw a stop light
LIGHT_RADIUS = 25
STOPLIGHT_WIDTH = 100
STOPLIGHT_HEIGHT = 250
BUFFER = 75
# Implement a function that draws a single circle
# with radius LIGHT_RADIUS.
# The circle should be in the center of the screen horizontally.
# Use the parameters for the y position and color
width=get_width()/2
height=get_height()/2
rect = Rectangle(STOPLIGHT_WIDTH, STOPLIGHT_HEIGHT)
rect.set_position(width-50, height-125)
rect.set_color(Color.gray)
add(rect)
def draw_circle(y_pos, color):
circ=Circle(LIGHT_RADIUS)
circ.set_color(color)
circ.set_position(width, y_pos)
add(circ)
yellow = Color.yellow
red = Color.red
green = Color.green
draw_circle(height, yellow)
draw_circle(height-BUFFER, red)
draw_circle(height+BUFFER, green)

5.3.6: Pool Table | CodeHS correct answers POOL_BALL_RADIUS = 40
FONT_TYPE = "30pt Arial"
# Write a function called draw_pool_ball that draws a pool ball.
def draw_pool_ball(color, x, y):
circle = Circle(POOL_BALL_RADIUS)
circle.set_position(x, y)
circle.set_color(color)
add(circle)

txt = Text
txt.set_position(x-10,y+20)
txt.set_color(Color.white)
txt.set_font("30pt Arial")
add(txt)
draw_pool_ball(Color.orange, 5, 100, 100)
draw_pool_ball(Color.red, 3, 150, 350)
draw_pool_ball(Color.blue, 2, 250, 140)
draw_pool_ball(Color.green, 6, 50, 200)

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
ProPerfomer (self)
View profile
Follow You need to be logged in order to follow users or courses
Sold
431
Member since
2 year
Number of followers
322
Documents
8502
Last sold
1 week ago
Global Scholars’ Resource Hub

Welcome to your ultimate exam success hub! We provide top-quality, up-to-date, and approved exam materials—study guides, practice tests, and notes for a variety of subjects. Whether you’re preparing for school, college, or professional exams, our resources are designed to help you study smarter and score higher. Thousands have passed with our materials—now it’s your turn!Need more resources or something specific? Contact me anytime, and I’ll be happy to help you find exactly what you need. Your success is our mission!" ✅ Covers multiple subjects and exam types ✅ Includes real practice questions, answers, and study tips ✅ Ideal for students, test takers, and last-minute review Your Exam Success Starts Here – Grab Your Bundle Before It’s Gone!

Read more Read less
3.9

83 reviews

5
36
4
25
3
9
2
1
1
12

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions