#๐Ÿ”’ What is wrong with this code??

24 messages ยท Page 1 of 1 (latest)

wild mapleBOT
#

@low nest

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.

dry tide
#

your arguments to random.randint() are not mathematically valid

#

randint(1,0) is not valid

low nest
#

but when you enter zero this should pop out

#
if pocitaccislo == 0:
    print("You cant have zero chances!")
    pocitaccislo = int(input("How many guesses do you want to have? (max 100) "))
#

the code should repeat

dry tide
#

this is why validation of input always come first

low nest
#

ahhhh

#

how can i fix it?

dry tide
#

move your random.randint to a part where input is valid

dry tide
low nest
#

wdym? like to the funxtion

#

move it to function?

dry tide
#

i am not sure what your code does so i cant really say

low nest
#

the program is about that computer picks random number and you have to guess it

#

but before you want to guess it

dry tide
#

but i do know that line should be after you validate it

low nest
#

from what range you want to guess it

#

but it has to be even number

#

thats where comes this function

#
def sude(): #<- even number
    pocitaccislo = 0
    while pocitaccislo <= 98:
        pocitaccislo += 2
wild mapleBOT
#
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.