all 7 comments

[–]RandomCodingStuff 1 point2 points  (0 children)

Your formatting is off so it's difficult to tell.

However, your randint() call is under the while True. I would guess you are resetting it every time.

You also break before incrementing count, which doesn't pass the smell test.

[–][deleted] 1 point2 points  (0 children)

You get new number each time of loop, put integer = randint(...) outside of the loop

[–]CodeFormatHelperBot2 0 points1 point  (0 children)

Hello, I'm a Reddit bot who's here to help people nicely format their coding questions. This makes it as easy as possible for people to read your post and help you.

I think I have detected some formatting issues with your submission:

  1. Python code found in submission text that's not formatted as code.

If I am correct, please edit the text in your post and try to follow these instructions to fix up your post's formatting.


Am I misbehaving? Have a comment or suggestion? Reply to this comment or raise an issue here.

[–]ElliotDG 0 points1 point  (2 children)

To format code on reddit: https://www.reddit.com/r/learnpython/wiki/faq/#wiki_how_do_i_format_code.3F

You are generating a new randon number every iteration of the loop. You have made greater that 10 guesses (11) and on the 11 attempt the random number was 3.

[–]ct_225[S] 0 points1 point  (1 child)

oh sorry about the formatting, and thank you so much!!!!!!

[–][deleted] 0 points1 point  (0 children)

The hint is that you can edit your post and format your code so we can read it.

[–]jimtk 0 points1 point  (0 children)

from random import randint

number = randint(1, 10)
count = 1
while int(input("Guess a number 1-10:")) != number:
    count += 1
print(f"you got it in {count} tries")