[Python] While function trouble

Discussão em 'Python' iniciado por Stack, Agosto 25, 2025.

  1. Stack

    Stack Membro Participativo

    For some reason, when I try to set a while function, it doesn't do what I want.

    For example:

    import random

    x = 0
    while x <= 10:
    print random.randint(1, 100)
    x += x + 1


    This only runs four times. But if I change it to while x <= 1000: it runs ten times. Any idea why?

    Continue reading...

Compartilhe esta Página