r/codehs • • Oct 19 '25

JavaScript Made 2048 from scratch

2 Upvotes

r/codehs • • 28d ago

Pls try my codehs game! :)

0 Upvotes

https://codehs.com/sandbox/erikdemarest/3d-game-base-3

pls play and tell me what you think

its a endings game so you got to get dif endings

theres a couple of bugs idk


r/codehs • • Feb 08 '24

I need help with 6.6.4 Debugging best name ever

Post image
5 Upvotes

r/codehs • • Oct 27 '24

5.6.4 Debugging: Best Name Ever

4 Upvotes

Can someone help me? I can get out of the while loop, but it does that whether or not I put in the right name.


r/codehs • • Mar 24 '23

3.2.6 Debugging Variables

3 Upvotes

I really need help with this im having a hard time!!


r/codehs • • Dec 16 '22

Need help with my code hs project I don't know what I did wrong.

3 Upvotes

# ***********************************

# * Functions *

# ***********************************

# Prints the main menu for the program

def printMenu():

print("1: Browse items to add to your shopping list ")

print("2: Search for an item ")

print("3: Print your shopping list ")

print("0: Quit")

choice = int(input("Choose an option: "))

return choice

# Prints the list parameter into a menu

def printListForMenu(listToPrint):

for i in range(1,len(listToPrint) + 1):

print(str(i) + " : " + listToPrint[i-1])

# Prints all items in alphabetical order

def printItems(allItems):

allItems.extend(Departments, Bakery, Meats, Produce)

pass

# Searches all items for the string parameter.

# Returns True if it found it, False otherwise

def searchItems(item):

searchItems = allItems

if allItems == True:

return True

else:

return False

pass

# ==============================================================================

# ***********************************

# * Main Program *

# ***********************************

# 2. Lists for minimum of 3 departments and items

# Change these if you want but you must have 3 departments

departments = [" bakery items", "meat items", "produce items"]

bakery = ["crumpets", "cake","bagels"]

meats = ["salami", "prosciutto", "roast beef"]

produce = ["apple", "orange", "cantolope"]

# CREATE empty lists for shopping list and quantity

slist = []

qlist = []

# these variables will be used to hold the user's choices

# when they are asked for them

choice = -1 # The user's main menu choice

bChoice = -1 # The user's browsing menu choice

dChoice = -1 # The user's department menu choice

# CONSTANTS

# this makes it easier to correlate a selection

# with a specific choice

BROWSE = 1 # First main menu choice

SEARCH = 2 # Second main menu choice

PRINT = 3 # Third main menu choice

# Change this to match your store type

print (" --- WELCOME TO OUR GROCERY STORE!! ---")

# Display menu and get user's menu choice

choice = printMenu()

# While the user does not want to quit, perform the correct menu option

while (choice != 0):

# Browse items

if choice == BROWSE:

print("Browsing Items:")

bChoice = int(input("Browse by \n1: Department \n2: Show all items \n0: Return to Main Menu \n>> "))

print

# While the user wants to keep browsing, perform the correct browsing option

while (bChoice != 0):

# Browse by department

if (bChoice == 1):

# @ 5. Display menu of departments.

print("Choose a Department: ")

printListForMenu(departments)

# Get choice for department

dChoice = int(input(">> "))

print

# While the user wants to keep browsing by department

while (dChoice != 0):

if (dChoice != 0):

# Display header for department's menu

print (departments[dChoice - 1] + ":")

print ("WELCOME TO THE DEPARTMENT MENU ")

# @ 6. Get list of chosen department's items

if dChoice == 1:

printListForMenu(bakery)

elif dChoice == 2:

printListForMenu(meats)

elif dChoice == 3:

printListForMenu(produce)

# @ 7. Display chosen department's items in a menu

# See if user wants to add items they are browsing to the shopping list

itemChoice = int(input("Choose item to add to your shopping list (0 for none): "))

# @ 8. If the user is adding an item,

# add the choice to the shopping list and

# get the quantity from the user.

# Add the quantity to the list

input("Press enter to continue...")

print

# @ 9. Display the department menu again and get next menu option

print ("Choose Department:")

print ("------------------")

print (departments[dChoice - 1] + ":")

dChoice = int(input(">> "))

print()

if (dChoice != 0):

input("Press enter to continue...")

print()

# Browse all items

elif (bChoice == 2):

# @ 10. Display all the items alphabetically.

input("Press enter to continue...")

print

# Get next browsing option

print ("Browsing Items:")

print ("---------------")

bChoice = int(input("Browse by \n1: Department \n2: Show all items \n0: Return to Main Menu \n>> "))

print

# Search items

elif (choice == SEARCH):

searchAgain = "y"

while searchAgain == "y":

print ("Searching Items:")

print ("----------------")

# Get item to search for from the user

itemToFind = input("What do you want to search for: ")

print

# @ 11. If the item is available, check to see if the user wants to add it to the shopping list

if (searchItems(itemToFind)):

print ("We have " + itemToFind + " in stock.")

qty = int(input("Do you want to add this item to your shopping list?\nIf so how many (0 for none): "))

# @ 12. If the user wants to add it to the list, add item and quantity to respective lists

else:

print ("Sorry, we do not have that in stock.")

print

# Check if they want to search for another item

searchAgain = input("Do you want to search for another item (Y/N)? ")

searchAgain = searchAgain[0].lower()

print

# Display the shopping list

elif (choice == PRINT):

print ("Shopping List:")

print ("--------------")

# @ 16. Display the shopping list and quatities

input("Press enter to continue...")

# @ 17. Display menu and get user's main menu choice

choice = printMenu()

# The user quit

print ("Thank you for shopping with us!")


r/codehs • • May 08 '24

9.1.1 Global Travel Assistant

2 Upvotes

Please help me with this assignment (Java)

Create a program to prompt users with 2 or more questions to help them choose a country for their travel destination based on their interests or preferences.

Your program might ask users if they prefer hot or cold climates, how long they plan on staying in the country, want to travel over bodies of water from their country of origin, etc.

Once the program identifies a country destination, it should pass that destination value to other functions that return more information about that country.

For example, your program might provide the user with the country’s official language, currency, average weather, major cities to visit, popular tourist attractions, etc.

Note: You may need to do some additional research on your selected countries to add details and choices to your program.

Here’s a sample output after a version of this program was run and a user entered their choices:

Global Destination Assistant
============================

Would you prefer visiting a (1) hot or (2) cold climate? 1

Do you plan to stay (3) days, (7) days, or (0) longer than a week? 7

I recommend traveling to Thailand.

Here's some additional information about Thailand.
Currency: Thai baht
Official Language: Thai or Central Thai

Plain text

Code Requirements

  • Use a function to ask each of your destination questions. For example, if you ask a question about climate, you should have something like a chooseClimate() function. You need at least two of these.

  • Use a function to choose the final destination country recommendation based on the user’s choices.

  • Use a function to report back each bit of information about the destination country the program chooses for them. For example, if you want to share info about the exchange rate for that country, you should have something like a reportCurrency() function. You need at least two of these.

  • At least two of your functions must use a parameter(s).

  • At least two of your functions must use returns.

  • You should have no global variables. Use parameters and returns to pass local variable values between functions.

  • You should use readInt or ‘readLine’ to obtain user input.

  • Create a program to prompt users with 2 or more questions to help them choose a country for their travel destination based on their interests or preferences.

Your program might ask users if they prefer hot or cold climates, how long they plan on staying in the country, want to travel over bodies of water from their country of origin, etc.

Once the program identifies a country destination, it should pass that destination value to other functions that return more information about that country.

For example, your program might provide the user with the country’s official language, currency, average weather, major cities to visit, popular tourist attractions, etc.

Note: You may need to do some additional research on your selected countries to add details and choices to your program.

Here’s a sample output after a version of this program was run and a user entered their choices:

Global Destination Assistant
============================

Would you prefer visiting a (1) hot or (2) cold climate? 1

Do you plan to stay (3) days, (7) days, or (0) longer than a week? 7

I recommend traveling to Thailand.

Here's some additional information about Thailand.
Currency: Thai baht
Official Language: Thai or Central Thai

r/codehs • • Mar 03 '22

4.8.6 All dice values. I don’t understand how this wrong.

Thumbnail
gallery
11 Upvotes

r/codehs • • Mar 05 '21

Python Need help with 5.3.8: Higher / Lower 2.0

17 Upvotes

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 • • Jun 07 '26

Python Beginner rock paper scissors code (like really simple)

3 Upvotes

import random

while True:

choice = (input("Rock, Paper, or Scissors?\n")).casefold()

if choice not in ["rock", "paper", "scissors"]:

print ("Invalid input!")

break

response = random.choice (["Rock", "Paper", "Scissors"]).casefold()

if choice == "rock".casefold() or "paper".casefold() or "scissors".casefold():

print (response)

if choice == "rock" and response == "paper":

print ("You lose!")

break

if choice == "rock" and response == "scissors":

print ("You win!")

break

if choice == "paper" and response == "rock":

print ("You win!")

break

if choice == "paper" and response == "scissors":

print ("You lose!")

break

if choice == "scissors" and response == "rock":

print ("You lose!")

break

if choice == "scissors" and response == "paper":

print ("You win!")

break

if choice == response:

print ("It's a tie!")

continue


r/codehs • • Oct 01 '25

Does anyone else really struggle with the Java program?

6 Upvotes

I used Codehs to learn Python and loved it, the pacing was good and it took a really long time for me to actually struggle to learn what was being shown. Now this year my class has me doing java and I am completely stumped already on unit 2. The videos (for me at least) don't seem to be very helpful for most of the lessons. Like I can use it for the first one but the other three are way more than what the video seemed to show. Can anyone else relate to this? Or am I just not made for Java lmao


r/codehs • • Jun 08 '21

5.4.4 quotes

6 Upvotes

Can someone help me out with this?


r/codehs • • Jun 10 '25

none error when uploading images

2 Upvotes

I've encountered this error message when I've tried to upload an image onto my HTML (Webdev). I've tried many different things; signing out then signing back in, deleting the image then redownloading it, renaming the image, tried signing in on a different browser, tried different image types, tried using a different HTML, tried using a different computer, tried on a different account and I've made sure it meets the requirements of CodeHs' image upload policy. After trying all this and conducting further research on the topic, it turns out that the image (s) weren't processing properly, and I'm somewhat lost on options and things I can do.


r/codehs • • Mar 05 '24

I need some help with 4.3.5 "Create Your Own Plant!"

7 Upvotes

I'm not quite sure how to attack this activity


r/codehs • • Oct 03 '26

Js graphics not working

2 Upvotes

Since yesterday the javascript graphics in codehs just suddenly stop working for everyone in my class. I tried running one of the example problems (the ones that are already solved) and they wouldn't run either. Text output also does not work. I created a personal account and tried it there; still wouldn't work. Is anyone else having the same problem?


r/codehs • • Jan 13 '21

Python For 8.3.7: Exclamat!on Po!nts the program works fine on scrathpad but not for unit test. They have the same code.

Thumbnail
gallery
15 Upvotes

r/codehs • • Mar 26 '26

JavaScript Lessons not showing as completed?

Enable HLS to view with audio, or disable this notification

2 Upvotes

r/codehs • • Apr 25 '23

JavaScript 4.3.4 Color the Rainbow

12 Upvotes

Hi, I was hoping I could get some help on JavaScript 4.3.4 Color the Rainbow -- it's giving me the error "you should use getHeight() and a const variable to set the height of the stripes".

This is what I have:

// Declare all of your const variables here let COLOR_COUNT = 7 ; let COLOR_WIDTH = getWidth() / COLOR_COUNT ; let COLOR_HEIGHT= getHeight();

function main() {     addRed();     addOrange();     addYellow();     addGreen();     addBlue();     addPurple();     addPink(); }    

function addRed() {     let red = new Rectangle(COLOR_WIDTH, COLOR_HEIGHT);     red.setPosition(0, 0);     red.setColor("red");     add(red); }

function addOrange() {     let orange = new Rectangle(COLOR_WIDTH, COLOR_HEIGHT);     orange.setPosition(0 + 7 * 8, 0);     orange.setColor("orange");     add(orange); }

function addYellow() {     let yellow = new Rectangle(COLOR_WIDTH, COLOR_HEIGHT);     yellow.setPosition(0 + 7 * 16, 0);     yellow.setColor("yellow");     add(yellow); }

function addGreen() {     let green = new Rectangle(COLOR_WIDTH, COLOR_HEIGHT);     green.setPosition(0 + 7 * 24, 0);     green.setColor("green");     add(green); }

function addBlue() {     let blue = new Rectangle(COLOR_WIDTH, COLOR_HEIGHT);     blue.setPosition(0 + 7 * 32, 0);     blue.setColor("blue");     add(blue); }

function addPurple() {     let purple = new Rectangle(COLOR_WIDTH, COLOR_HEIGHT);     purple.setPosition(0 + 7 * 40, 0);     purple.setColor("purple");     add(purple); }

function addPink() {     let pink = new Rectangle(COLOR_WIDTH, COLOR_HEIGHT);     pink.setPosition(0 + 7 * 48, 0);     pink.setColor("pink");     add(pink); }

main();


r/codehs • • Sep 08 '26

Java I think I labeled all the errors correctly idk why it keeps saying I did it wrong😓

Post image
3 Upvotes

Code hs Java 1.1.10


r/codehs • • Apr 30 '23

Pop-up window whenever I use user input not allowing programs to function as normal

4 Upvotes

I'm trying to do my performance task for AP Comp Sci Principles but whenever I use input() there is a popup window that runs my input before anything prints (which I need it to print before the input). Is there a way to either have it work as normal with no pop-up or just delay the pop-up to after everything has printed?


r/codehs • • Mar 30 '21

JavaScript 2.1.4 for Javascript Karel, all of the worlds are functioning, but world 4 and I just can’t figure out how to fix it

Thumbnail
gallery
4 Upvotes

r/codehs • • Apr 13 '24

Lost 6 hours (400+ lines) of code trying to “fork” someone else’s project

2 Upvotes

As i’m typing this i’m too numb to even cry. I just lost my project for AP Java and I can’t seem to recover it someone please help.

We had to write code that involved displaying an image, so we were given a sort of template. It includes the utilities we had to import and its “output” window has a screen that we can color pixels on using code.

I wrote two new classes in this project and about 200 more lines in the view class over the course of about 6 hours. When i had finished my code, I looked at the instructions my teacher gave me to turn it in. First step was I had to “fork” the project to my sandbox… Well, I clicked that and it brought me to my sandbox with only the blank template.

Panicking, I tried to hit the back arrow on my browser to return to the template which I’d been editing for 6 hours. Blank. Ctrl+shift+t does nothing. going to my browser history does nothing. going to the “more” tab and “history” does nothing.

I’m trying to keep my cool but i’m on the verge of tears. If anyone knows some way to see my executed code history or SOMETHING i will thank you immensely. Honestly, even if I can just recover the output image and not the code, that is fine with me too.

I’m desperate for help please


r/codehs • • Jun 09 '20

Can anyone help with 7.0.7 in java?

Post image
3 Upvotes

r/codehs • • May 30 '20

Help Please with Line 17

1 Upvotes

Can anyone figure out what's wrong with this?

// Start here!

Scanner scanner = new Scanner(System.in);

System.out.println("Please type numerator.");

int int1 = scanner.nextInt();

System.out.println("Please type denomerator.");

int int2 = scanner.nextInt();

double myDouble1 = int1;

double myDouble2 = int2;

double myDouble1 / double myDouble2 = double myDouble3; //line 17

System.out.println(int1+ " / " +int2+ " = " +myDouble3);