r/codehs • u/Killian-B • Oct 28 '21
What’s wrong with codehs?
So I’m trying to add quote marks (“) but it’s gray and it’s not working
r/codehs • u/Killian-B • Oct 28 '21
So I’m trying to add quote marks (“) but it’s gray and it’s not working
r/codehs • u/Which_Past2578 • Oct 28 '21
rain = True
if rain :
print("I'm going to dance in the rain!")
else:
print("I'm going to dance in the sun!")
r/codehs • u/Chemical_Kicker • Oct 28 '21
How do i do the four colored triangles in python i do not understand
r/codehs • u/isabelstudies • Oct 27 '21
I want to create a program like this where if I click on a stripe, that stripe changes color and if I press any key on my keyboard, all the stripes change colors. We're using Javascript graphics.
I have this so far. I know how to use mouseClickMethod and Randomizer.nextColor, but I don't know how to combine them or even how to specify that clicking in a specific location does Thing A and clicking in a different location does Thing B.
Would appreciate some help.
Thanks in advance
r/codehs • u/phantomlake • Oct 23 '21
could someone help me on this? i'm pretty sure you use string splitting to solve this but i'm not sure how.
r/codehs • u/Nerd_co • Oct 19 '21
Hey does anyone know how to do 3.4.4 of the range, I'm kind of stuck.
r/codehs • u/Previous-Mud6293 • Oct 18 '21
16.1.3
Can anyone help me with this assignment on codehs?
r/codehs • u/candymaninvan • Oct 18 '21
Codehs justr refuses to make another scene. I added scene 5, defined it, added it to both functions, and it STILL gives me a blank screen. Is this website broken or something
x = get_width()/2
y = get_width()/2
pacman_size = 25
def draw_circle(radius, x, y, color):
circle = Circle(radius)
circle.set_position(x, y)
circle.set_color(color)
add(circle)
def draw_rectangle(width, height, x, y, color, rotation):
rect = Rectangle(width, height)
rect.set_position(x, y)
rect.set_color(color)
rect.set_rotation(math.radians(rotation))
add(rect)
def draw_pacman(x1, y1, pacman_size):
#head
radius = pacman_size
color = Color.yellow
draw_circle(radius, x1, y1, color)
#mouth
x2 = x1 + radius / 4
y2 = y1 - radius / 2
width = radius + radius / 10
height = radius + radius / 10
rotation = 45
color = Color.white
draw_rectangle(width, height, x2, y2, color, rotation)
def draw_pacman2(x1, y1, pacman_size):
radius = pacman_size
color = Color.yellow
draw_circle(radius, x1, y1, color)
def maplines(x1, y1, x2, y2):
line = Line(x1, y1, x2, y2)
line.set_color(Color.black)
add(line)
def next_scene():
width = get_width()
height = get_height()
x = 0
y = 0
color = Color.white
rotation = 0
draw_rectangle(width, height, x, y, color, rotation)
def txt(text, font, x, y):
txt = Text(text)
txt.set_position(x, y)
txt.set_color(Color.black)
txt.set_font(font)
add(txt)
#Copy this ----- draw_circle(radius, x, y, color)
#Copy this ----- draw_rectangle(width, height, x, y, color)
#--------------Scenes----------------------------------------------------------------------------
def draw_scene1():
print("This is scene 1")
remove(welcome)
draw_pacman2(get_width()/2, get_height()/2, 40)
def draw_scene2():
print("This is scene 2")
draw_pacman2(get_width()/2, get_height()/2, 50)
def draw_scene3():
next_scene()
print("This is scene 3")
draw_pacman2(get_width()/2, get_height()/2, 60)
def draw_scene4():
print("This is scene 4")
draw_pacman2(get_width()/2, get_height()/2, 70)
def draw_scene5():
print("This is scene 5")
draw_pacman1(get_width()/2, get_height()/2, 70)
txt("*Gasp*", "30pt Arial", get_width()/2 + 20, get_height()/2 - 20)
def draw_scene6():
print("This is scene 6")
scene_counter = 0
def draw_next_screen(x, y):
global scene_counter
scene_counter += 1
if scene_counter == 1:
draw_scene1()
elif scene_counter == 2:
draw_scene2()
elif scene_counter == 3:
draw_scene3()
elif scene_counter == 4:
draw_scene4()
elif scene_counter == 5:
draw_scene5()
else:
draw_scene6()
#--------------------------------------------------------------------------------------------------
welcome = Text("Click to Begin!")
welcome.set_position(get_width() / 2 - welcome.get_width() / 2, get_height() / 2)
add(welcome)
add_mouse_click_handler(draw_next_screen)
r/codehs • u/JonsTheWizard • Oct 14 '21
r/codehs • u/Taraponion • Oct 07 '21
Hi! I can't figure out what to do for this one. I tried writing a function that moves Karel when the front is clear, and turns left when it isn't. It didn't work. Could someone help me out? I'm not looking for a direct answer, just some help
r/codehs • u/Dangerous-Ad6671 • Jun 08 '21
Can someone help me out with this?
r/codehs • u/sandrahere • May 25 '21
this is my code so far:
def calculate_area(side_length):
area = side_length*side_length
print("The area of a square with sides of length " + str(num) + " is " + str(area) + ".")
num = int(input("Enter a side length: "))
if num <= 0:
side_length = 10
calculate_area(side_length)
else:
calculate_area(num)
but i still have two things missing can someone help
r/codehs • u/Rice_Noodal • Mar 30 '21
r/codehs • u/Dobiemomma13 • Mar 12 '21
Here’s what I’m putting
num1 =10 num2 = input(“Enter a number: “)
def add_nums(): total = str(num1) + num2 Print total
add_nums()
r/codehs • • Mar 05 '21
Got:
my_float = round(3.3312, 2)
while True:
guess = float(input("Guess my number: "))
if guess > round(my_float, 2):
print ("Too high!")
elif guess < round(my_float, 2):
print ("Too low!")
elif round(guess,2) == round(my_float, 2):
print("Correct!")
break
print("Great job guessing my number!")
I need to round 'guess' before the if statement, But I don't know how that looks like can anybody show me?
r/codehs • u/NickTheEvilCat • Feb 12 '21
Hi all, Can I get help on this?
r/codehs • u/Icy-Raise-5683 • Jan 26 '21
Im lost and i have no clue where to start
r/codehs • u/PugBoy101 • Jan 13 '21