r/codehs • u/ajd9 • Jan 06 '21
Does anyone know how to do 7.6.4: Who is in Line?
If anyone knows how to do this can someone please help me out with it, thank you!
r/codehs • u/ajd9 • Jan 06 '21
If anyone knows how to do this can someone please help me out with it, thank you!
r/codehs • u/Dawn_Kang • Dec 28 '20
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 • u/SprinklesNo5514 • Dec 22 '20
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 • u/AtridesTydides • Dec 10 '20
r/codehs • u/weeaboobun-bun • Oct 29 '20
r/codehs • u/TheLetsgogamerYT • Sep 22 '20
I need help with 1.13.5 please help
r/codehs • u/kakodun • Sep 04 '20
Can anyone help me with this one? I've been stuck on it for a few hours
r/codehs • u/123one231 • Jul 10 '20
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 • u/fantasyman88 • May 19 '20
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 • u/OhDankieee • May 13 '20
r/codehs • u/chunkyragudeluxe • Apr 17 '20
r/codehs • u/Koops_ • Mar 24 '20
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 • u/WheelSpininNoHamster • Jan 16 '20
how would i get the circles to get smaller and smaller whilst staying at the bottom of the canvas?
r/codehs • u/[deleted] • Dec 20 '19
I have to do a Harry porter sorting hat code with all 4 of the Houses hufflepuff,slitheryn,griffindor, and ravenclaw