#๐Ÿ”’ help with homework

19 messages ยท Page 1 of 1 (latest)

pastel vineBOT
#

@lethal frost

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

lethal frost
#

thats the thing

#
import random

def main():
    lowestNum = 1
    highestNum = 100
    randomNum = random.randint(lowestNum, highestNum)
    tries = 0
    endTries = 100
    while tries < endTries:
        randomGuess = int(input("Guess a number between " + str(lowestNum) + " and " + str(highestNum) ))
        if randomGuess < 0 :
             print("Guess cannot be less than 0")
        elif randomGuess > 100 :
            print("Guess cannot be more than 100")
            
        tries += 1
        
    if randomGuess == randomNum :
        print("You guessed the number " ,randomNum, "in only" ,tries, "attempts")
        return
    if randomGuess > randomNum:
        print("You guessed too high,Please guess lower.")
    elif randomGuess < randomNum:
        print("You guessed too low,Please guess higher.")
        
    


main()


#

when i run it

#

the second part doesnt even come out

#

after tries +=1

#

and thats what i get

chrome quarry
lethal frost
#

okay one sec

#

okay thank you it worked

#

but it

#

did i mess up on the tries

#

because it let me do 14 tries and didnt stop at 10

#

wait nvm

#

iaccidentally put 100 instead of 10

#

thank you

pastel vineBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.

#

๐Ÿ”’ help with homework