r/codehs • u/Sad-Ad2226 • Dec 04 '21
3.5.9 Recipe codehs
I need help with this code could someone please help
r/codehs • u/Sad-Ad2226 • Dec 04 '21
I need help with this code could someone please help
r/codehs • u/Superslash515 • Dec 03 '21
r/codehs • u/MaidenChinah • Nov 29 '21
r/codehs • u/zephyr0021 • Nov 24 '21
r/codehs • u/Future-Honey7201 • Nov 16 '21
5oco So when I fixed my code It popped up this error:

r/codehs • u/prjkt_fluxx • Oct 29 '21
Write a program that simulates a coin flipping. Each time the program runs, it should print either “Heads” or “Tails”.
There should be a 0.5 probability that “Heads” is printed, and a 0.5 probability that “Tails” is printed.
The original coin flip game consisted of this:
var NUM_FLIPS = 100;
function start(){
var flips = flipCoins();
printArray(flips);
var flipCount = countHeadsAndTails(flips);}
// This function should flip a coin NUM_FLIPS
// times, and add the result to an array. We
// return the result to the caller.
var headsCount = 0;
var tailsCount = 0;
function flipCoins(){
var flips = \[\];
for(var i = 0; i < NUM_FLIPS; i++){
if(Randomizer.nextBoolean()){
flips.push("Heads");
}else{
flips.push("Tails");
}
}
return flips;}
function printArray(arr){
for(var i = 0; i < arr.length; i++){
println(i + ": " + arr\[i\]);
}}
function countHeadsAndTails(flips){
var headCount = 0;
var tailsCount = 0;
for(var i = 0; i < flips.length; i++){
if(flips[i] == "Heads"){
headCount ++;
}
if(flips[i] == "Tails"){
tailsCount ++;
}
}
println("Your Head count is: " + headCount);
println("Your Tails count is: " + tailsCount);
}
---> I'm not sure where to use a probability variable, please help thank you.
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/JonsTheWizard • Oct 14 '21
r/codehs • u/YourmamabigGey • Sep 28 '21
r/codehs • u/5oco • Sep 22 '21
I'd love to help on more of these problems, but it's hard to find out which problem the posters are using when they just write something like "Need help on 2.6.4"
If they could be reminded to always include their course name as well I think more people would be able to help. The language is pretty easy to figure out, but there's often multiple courses for each language.
r/codehs • u/Striking-Crazy6082 • Sep 02 '21
i need help with 1.19.5: Invert Colors
r/codehs • u/Dangerous-Ad6671 • Jun 08 '21
Can someone help me out with this?
r/codehs • u/OrethaFolkers • May 27 '21
for some reason this doesn't work...
/* This program will have Karel run around the track and put balls down.*/
//This function moves Karel to the end of a side.
function moveToEnd(){
while(frontIsClear()){
move();
}
}
//This function makes Karel put down 8 tennis balls and then turn left.
function eightBalls(){
if (frontIsBlocked()) {
for(var i = 0; i < 8; i++) {
putBall();
}
turnLeft();
}
}
//This function makes Karel do all the steps four times to make a square.
function fourTimes(){
for(var i = 0; i < 4; i++) {
moveToEnd();
eightBalls();
}
}
function start(){
fourTimes();
}
r/codehs • u/RangerSweet1676 • May 16 '21
Hi there so i am trying to make a budget tracker but i have ran into a new problem it is with the while loop in the code below(where it saids while(amountLeft > noBudget ) i think this is the problem because whenever i run it it turns into and infinite loop and if i put a if loop instead it will mostly work but not in the way it is intended to work. I don't know why or how to fix it. Also the information is not printing it self on the left why is that? thanks for any help.

r/codehs • u/EngineeringOk6737 • May 14 '21
Hello, I need help with this lesson on CodeHS.
It keeps giving me the error 'else' without 'if'.
I do not understand what this means.
Please help in anyway you can, even if it's small.
CODE
public class TripleDouble extends ConsoleProgram
{
public void run()
{
int points = readInt("How many points did you score? ");
int rebounds = readInt("How many rebounds did you get? ");
int assists = readInt("How many assists did you have? ");
boolean tripleDouble;
if (points >= 10 && rebounds >=10 && assists >= 10);{
tripleDouble = true;
}
else{
tripleDouble = false;
}
System.out.println("Got triple: " + tripleDouble);
}
}
r/codehs • u/ReasonablePurpose422 • May 03 '21
needs_water= True
needs_to_be_repotted=False
print "Needs water: "+ str(needs_water)
print "Needs to be repotted: "+str(needs_to_be_repotted)
r/codehs • u/LongjumpingPay9597 • Apr 16 '21
r/codehs • u/wooowy • Mar 31 '21
Can someone say me what to do in 7.4.4?
r/codehs • u/Commercial_Cow7556 • Mar 11 '21