Is my code easily readable? If not how can i improve it? /u/BlooDy_Wongi Python Education

I’m new to coding i made a little guessing game and was wondering if it’s easy to read for other programmers. Here’s the code:

# Number guessing game import random, time keep_playing = True HIGHEST_NUM = 100 LOWEST_NUM = 0 num_of_guesses = 0 score = 110 answer = random.randint(LOWEST_NUM, HIGHEST_NUM) total_score = 0 games_played = 0 print((f"Guess a number between {LOWEST_NUM} and {HIGHEST_NUM}" f" (Type Q to stop playing): ")) while keep_playing: guess = input("Enter your guess: ") # Stop playing if guess.lower() == "q": print("Cya never") keep_playing = False # Number out of range or not elif int(guess) < LOWEST_NUM or int(guess) > HIGHEST_NUM: print(f"YOUR NUMBER IS OUT OF RANGE! ENTER A NUMBER BETWEEN {LOWEST_NUM} AND {HIGHEST_NUM}") # Direct the player elif int(guess) > answer: print("Your guess is too high") num_of_guesses += 1 elif int(guess) < answer: print("Your guess is too low") num_of_guesses += 1 # Results else: num_of_guesses += 1 score = score - (num_of_guesses * 10) print(f"YOUR ANSWER IS CORRECT! OMG IT REALLY IS {answer}") time.sleep(1.5) print(f"It took you {num_of_guesses} guesses to find this easy number") time.sleep(1.5) print(f"Your score is: {score} cookies") time.sleep(1) num_of_guesses -= num_of_guesses total_score += score score = (110 - score) + score answer = random.randint(LOWEST_NUM, HIGHEST_NUM) games_played += 1 # Play again? if not input("Would you like to play another game? (Yes/No) ") == "yes": print(f"Your total score is: {total_score} out of {games_played} games") time.sleep(1) print("Cya never") keep_playing = False 

submitted by /u/BlooDy_Wongi
[link] [comments]

​r/learnpython I’m new to coding i made a little guessing game and was wondering if it’s easy to read for other programmers. Here’s the code: # Number guessing game import random, time keep_playing = True HIGHEST_NUM = 100 LOWEST_NUM = 0 num_of_guesses = 0 score = 110 answer = random.randint(LOWEST_NUM, HIGHEST_NUM) total_score = 0 games_played = 0 print((f”Guess a number between {LOWEST_NUM} and {HIGHEST_NUM}” f” (Type Q to stop playing): “)) while keep_playing: guess = input(“Enter your guess: “) # Stop playing if guess.lower() == “q”: print(“Cya never”) keep_playing = False # Number out of range or not elif int(guess) < LOWEST_NUM or int(guess) > HIGHEST_NUM: print(f”YOUR NUMBER IS OUT OF RANGE! ENTER A NUMBER BETWEEN {LOWEST_NUM} AND {HIGHEST_NUM}”) # Direct the player elif int(guess) > answer: print(“Your guess is too high”) num_of_guesses += 1 elif int(guess) < answer: print(“Your guess is too low”) num_of_guesses += 1 # Results else: num_of_guesses += 1 score = score – (num_of_guesses * 10) print(f”YOUR ANSWER IS CORRECT! OMG IT REALLY IS {answer}”) time.sleep(1.5) print(f”It took you {num_of_guesses} guesses to find this easy number”) time.sleep(1.5) print(f”Your score is: {score} cookies”) time.sleep(1) num_of_guesses -= num_of_guesses total_score += score score = (110 – score) + score answer = random.randint(LOWEST_NUM, HIGHEST_NUM) games_played += 1 # Play again? if not input(“Would you like to play another game? (Yes/No) “) == “yes”: print(f”Your total score is: {total_score} out of {games_played} games”) time.sleep(1) print(“Cya never”) keep_playing = False submitted by /u/BlooDy_Wongi [link] [comments] 

I’m new to coding i made a little guessing game and was wondering if it’s easy to read for other programmers. Here’s the code:

# Number guessing game import random, time keep_playing = True HIGHEST_NUM = 100 LOWEST_NUM = 0 num_of_guesses = 0 score = 110 answer = random.randint(LOWEST_NUM, HIGHEST_NUM) total_score = 0 games_played = 0 print((f"Guess a number between {LOWEST_NUM} and {HIGHEST_NUM}" f" (Type Q to stop playing): ")) while keep_playing: guess = input("Enter your guess: ") # Stop playing if guess.lower() == "q": print("Cya never") keep_playing = False # Number out of range or not elif int(guess) < LOWEST_NUM or int(guess) > HIGHEST_NUM: print(f"YOUR NUMBER IS OUT OF RANGE! ENTER A NUMBER BETWEEN {LOWEST_NUM} AND {HIGHEST_NUM}") # Direct the player elif int(guess) > answer: print("Your guess is too high") num_of_guesses += 1 elif int(guess) < answer: print("Your guess is too low") num_of_guesses += 1 # Results else: num_of_guesses += 1 score = score - (num_of_guesses * 10) print(f"YOUR ANSWER IS CORRECT! OMG IT REALLY IS {answer}") time.sleep(1.5) print(f"It took you {num_of_guesses} guesses to find this easy number") time.sleep(1.5) print(f"Your score is: {score} cookies") time.sleep(1) num_of_guesses -= num_of_guesses total_score += score score = (110 - score) + score answer = random.randint(LOWEST_NUM, HIGHEST_NUM) games_played += 1 # Play again? if not input("Would you like to play another game? (Yes/No) ") == "yes": print(f"Your total score is: {total_score} out of {games_played} games") time.sleep(1) print("Cya never") keep_playing = False 

submitted by /u/BlooDy_Wongi
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *