r/code • u/No_Opportunist • Nov 13 '25
Help Please I don’t understand this
My assignment is telling I got the indentation wrong on lines three and four, I just don’t understand? I just started out on coding, I’m struggling a bit
r/code • u/No_Opportunist • Nov 13 '25
My assignment is telling I got the indentation wrong on lines three and four, I just don’t understand? I just started out on coding, I’m struggling a bit
r/code • u/[deleted] • Oct 02 '25
Question: WAP to print reverse of the given number....
r/code • u/GamingAlways123 • Jan 06 '22
r/code • u/[deleted] • May 19 '22
import random word = ["withdrawal", "compromise", "separation", "vegetarian", "artificial", "permission", "accountant", "investment", "assumption", "excitement"] secret_word = random.choice(word) guesses_left = 10 dashes = "-" * len(secret_word)
def get_guess(): while True: obtain_guess = input("Guess the letter: ") if obtain_guess.isupper(): print("the secret letter is lowercase") elif len(obtain_guess) > 1: print("the secret letter is only one character long") else: return obtain_guess
def update_dashes(word, dashes, guess): for i in range(len(word)): if word[i] == guess: dashes = dashes[:i] + guess + dashes[i+1:] return dashes ''' hello Mr.Hall its me Jeremy, if you see another student using this exact code they stole it from reddit, please give them a bad grade and thanks for being the best computer science teacher ever :) '''
while guesses_left > 0: print(dashes) guess = get_guess() dashes = update_dashes(secret_word, dashes, guess) if guess in secret_word: print("Guess is in secret word") print(str(guesses_left) + " incorrect guesses remaining") else: guesses_left -= 1 print("Guess is not in secret word") print(str(guesses_left) + " incorrect guesses remaining")
if "-" in dashes and guesses_left == 0:
print("You lose! The word was: " + secret_word)
break
elif "-" not in dashes and guesses_left >= 0:
print("You win! The word was: " + secret_word)
breakr/code • u/REDDIT_SUB_ADMIN • Apr 29 '22
r/code • u/[deleted] • Dec 13 '21
So I was try to do some JSON code and I got an error message and now I’m kinda stuck what should I do
r/code • u/TrueNegotiation7642 • May 19 '25
<!DOCTYPE html>
<html> <head> <style> button { background-color: black; color: white; } </style> <script> function generateNumber(max) { return Math.floor(Math.random() * max); } let numberGenerated = undefined document.getElementById("output").innerHTML = numberGenerated; </script> </head> <body> <button onclick=" numberGenerated = generateNumber(27); "> Generate </button> <p> your number is : <span id="output"></span> </p> </body> </html>
This is for a random number generator
r/code • u/LostNeedingHelp2022 • Sep 03 '22
r/code • u/viniciusntch • Dec 28 '19
Does someone know a site or app that you could help others with their task?
I would like to do some python task to improve/practice.
Thanks
r/code • u/Zestyclose-Thanks-29 • Jan 06 '25
I’ve tried this last year it made me quit trying to learn coding but I just got some inspiration and i can’t find anything online. Please help
r/code • u/EngineerOfTheWorld • May 27 '21
r/code • u/One_piece_weeb • Oct 28 '21
r/code • u/Sufficient_Flower415 • Jun 08 '26
r/code • u/Anonylost • Jun 03 '21
Does anyone know how to write a code preferably in c++ to find the index of an element of a list where the sum of prime numbers on the right equal the left? If you do kindly help I'm still a newbie it would be highly appreciated
r/code • u/Air_boy_202 • May 28 '21
r/code • u/JGGLDIFF • Jun 16 '23
So i really to create a Java Complier That Should Be Online Using Js , Please someone to help me m stuck so much and thank you very much