#๐ What is wrong with this code??
24 messages ยท Page 1 of 1 (latest)
@low nest
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.
your arguments to random.randint() are not mathematically valid
randint(1,0) is not valid
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
this is why validation of input always come first
move your random.randint to a part where input is valid
such as the else case here
i am not sure what your code does so i cant really say
the program is about that computer picks random number and you have to guess it
but before you want to guess it
but i do know that line should be after you validate it
which is what this does
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
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.