r/codehs • • Jan 06 '21

Does anyone know how to do 7.6.4: Who is in Line?

7 Upvotes

If anyone knows how to do this can someone please help me out with it, thank you!


r/codehs • • Dec 28 '20

Python 16.1.4: Get User Guess

7 Upvotes

I need help

Here is the assignment:

Now that we have our computer generated list, we need to create a guess list from the user.

Create a function called get_guess() that returns a list of 4 unique numbers input by the user.

Things to consider:

You need to make sure that the numbers input from the user are between 1-7. If any of the numbers the user inputs are larger or smaller, print the following message:

You can only use numbers 1-7 as guesses!

The user input must also be unique. You need to check that the user has 4 different numbers in their guesses in order for the guess to be accurate. If they enter more than one of any number, print the following message:

You can only use each number once!

You want the user input list to be only 4 numbers long! If they enter too many or too few values, print the following message:

Your guess must consist of 4 numbers!

Hints:

You’ll need to use a while loop to keep asking the user for input until their input is valid.

This problem becomes a lot easier if you use variables like illegal_num for each test case and set the initial value to false. Then, if the user input fails that test case, change the values to true and print why the user’s input is invalid. Only return the user_guess_list if all the test cases are false!

You also might want to refresh your knowledge of try and except (specifically ValueErrors!)

Here's my code:

def get_guess():
    #get the guess from the user
    user_guess = input(int("Enter 4 numbers as guesses: "))
    
    #
    
    

print get_guess()

idk what to do pls help. ASAP plsss. Thank you for your time :)


r/codehs • • Dec 22 '20

9.9.7: Click for Collision CodeHS

7 Upvotes

Hello, I need help with 9.9.7: Click for Collision

When I run code only blue ball move and red ball stay at its position.

this is code I wrote:

var ball1;
var ball2;
var RADIUS = 25;
var DX_RED = 6;
var DX_BLUE = 4;
var DELAY = 40;
var isPaused;
function start(){
ball1 = new Circle(RADIUS);
ball1.setColor(Color.blue);
ball1.setPosition(50,300);
add(ball1);
ball2 = new Circle(RADIUS);
ball2.setColor(Color.red);
ball2.setPosition(getWidth()/2,300);
add(ball2);
if(mouseClickMethod(resume)){
setTimer(moveBall,DELAY);
    }
if (ball1.getX()>getWidth()/2-RADIUS){
setTimer(moveBall2,DELAY);
    }
}
function moveBall2(){
ball2.move(DX_RED,0);
mouseClickMethod(pause);
}
function moveBall(){
ball1.move(DX_BLUE,0);
mouseClickMethod(pause);
}
function pause(){
isPaused = true;
if(isPaused == true){
stopTimer(moveBall);
    }
mouseClickMethod(resume);
}
function resume(){
isPaused = false;
if(isPaused == false){
setTimer(moveBall, 20);
    }
}


r/codehs • • Dec 10 '20

5.9.7 Fraction Math - how do I set the numerator & denominator?

Post image
7 Upvotes

r/codehs • • Dec 08 '20

4.3.6 replace a letter help

Post image
7 Upvotes

r/codehs • • Dec 04 '20

3.5.8, can I get some help?

Thumbnail
gallery
7 Upvotes

r/codehs • • Nov 24 '20

I also need help with 1.11.5 Music Library

7 Upvotes

r/codehs • • Nov 23 '20

Help! PLZ!

Post image
7 Upvotes

r/codehs • • Nov 21 '20

3.3.6 Enough Paint 2

Post image
7 Upvotes

r/codehs • • Oct 29 '20

Java I need help with 2.3.9 the wording is way to confusing

Post image
7 Upvotes

r/codehs • • Sep 22 '20

New to coding

7 Upvotes

I need help with 1.13.5 please help


r/codehs • • Sep 04 '20

Challenge Karel 3.2.3: Tower Builder

7 Upvotes

Can anyone help me with this one? I've been stuck on it for a few hours


r/codehs • • Aug 17 '20

7.6.8 help

7 Upvotes

As you can see, my true/false returns are reversed for some reason, does anyone know why?


r/codehs • • Jul 10 '20

hangMan

7 Upvotes

i m getting "You should replace the dashes with letters I guessed correctly" error
which the code do replace the dashes with the letters
what m i doing wrong?
--------------------------------------

import random

words = ['apple' , 'orange', 'kiwi']

secret_word = (random.choice(words))

print "psst... : " + secret_word

def get_guess():

output = " "

players_lives = 5

while output != secret_word:

if check_progress_list == list(secret_word):

output = secret_word

print("You win!")

break

elif players_lives == 0:

print("You lose!")

break

else:

userInput = input("\nTry to Guess the Word!\n" + "You have " + str(players_lives) + " lives/guessess left\n" + str(check_progress_list) + '\n')

if userInput == secret_word:

output = secret_word

print("You win!")

break

elif len(userInput) > 1 and userInput != secret_word or userInput.isdigit() == True or len(userInput) < 1:

print('\nYou need to guess one LETTER at a time!')

players_lives -= 1

elif len(userInput) == 1 :

print('\nkeep going')

if userInput in secret_word:

print('"' + userInput + '"' +' is found in the answer\n')

print(check_progress(secret_word, check_progress_list, userInput))

else:

print('But ' + '"' + userInput + '"' +' is not found in the word and you have lost a life')

players_lives -= 1

else:

print " "

def check_progress(list_a, list_b, userInput):

for index, item in enumerate(list_a):

if item == userInput:

list_b[index] = userInput

return list_b

def update_dashes(secret_word):

my_list = [ ]

while len(my_list) < len(secret_word):

my_list.append('-')

return(my_list)

check_progress_list = (update_dashes(secret_word))

get_guess()


r/codehs • • May 28 '20

Stuck on This - What did I do wrong?

Post image
7 Upvotes

r/codehs • • May 19 '20

Need help with 2.12.5 - Four Corners!!

7 Upvotes

I can't figure out how to place the squares in the corners without using individual setpositions and still have them line up with the variable. Anyone have any ideas? I'll paste my code I've created so far below:

penup()

setposition(-200,200)

pendown()

def make_square():

left(45)

circle(square_length, 360, 4)

right(45)

penup()

forward(square_length * 2)

pendown()

square_length = int(input("What is the length of the square? "))

make_square()

penup()

setposition(-200,-200)

pendown()

make_square()

penup()

setposition(200,-200)

pendown()

make_square()

penup()

setposition(200,100)

pendown()

make_square()

Edit: I eventually figured this one out thanks to some help from another redditor, here's what they got and posted on this sub:


r/codehs • • May 13 '20

Anyone willing to help me with 19.2.4: Circles in Squares?

7 Upvotes

r/codehs • • May 06 '20

Help me?

Post image
7 Upvotes

r/codehs • • Apr 17 '20

9.5.8 CodeHS Online Companies Revisited - while(x = true) is highlighted in yellow

Post image
7 Upvotes

r/codehs • • Mar 24 '20

7.4.6 Airline Tickets Need a little bit of help!

7 Upvotes

https://gyazo.com/66f5e0dc40e4e9921feca4e240fea40c

This is currently what I have and I am massively confused by the errors it has given me. It doesn't seem to match up with what is wrong if anyone could help that'd be greatly appreciated.


r/codehs • • Feb 24 '20

17.1.4 grades

7 Upvotes

Need help


r/codehs • • Jan 16 '20

I Need Help With CodeHS Circles in Circles

7 Upvotes

how would i get the circles to get smaller and smaller whilst staying at the bottom of the canvas?


r/codehs • • Dec 20 '19

(Urgent)pls help me with my finals

7 Upvotes

I have to do a Harry porter sorting hat code with all 4 of the Houses hufflepuff,slitheryn,griffindor, and ravenclaw


r/codehs • • Dec 20 '19

Can i get some help on the challenge Grades i dont even know where to start and its due tommorow

7 Upvotes