Hi this is a very simple game, the user guesses a number between 1-20 and is told if it is too high or low. If anyone has an idea that I (a python beginner) can do or suggestions to make this better please tell me. Thanks
@LizFoster You can use three backticks ` which, on American QWERTY keyboards, is left of the 1. Wrapping your code in three backticks will apply the regular formatting.
For example:
import random as r
number = r.randint(1, 20)
guess = int(input("I am thinking of a number between 1 and 20. What is it? "))
while True:
if guess > 20 or guess < 1:
guess = int(input("That's not in my range! Guess a number between 1 and 20: "))
elif guess > number:
print("Too high!")
guess = int(input("Try again: "))
elif guess < number:
print("Too low.. ")
guess = int(input("Try again: "))
else:
print("You guessed it! Good Job!")
break
Number Guessing Game
Hi this is a very simple game, the user guesses a number between 1-20 and is told if it is too high or low. If anyone has an idea that I (a python beginner) can do or suggestions to make this better please tell me. Thanks
For example:
https://repl.it/talk/learn/A-Quick-Guide-to-Replit-Talk-Markdown/7448