← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #402262]: Random number of times around a loop

 

Question #402262 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/402262

Roman Podolyan posted a new comment:
import random
random.seed()

for i in range(10):
    xtimes = random.randint(1, 5)
    print xtimes
    for x in range(xtimes):
        print "x"
    print "x loop is over\n" 


In output you are going to see random number of printed "x", something
like this:

1
x
x loop is over

3
x
x
x
x loop is over

4
x
x
x
x
x loop is over

1
x
x loop is over

1
x
x loop is over

5
x
x
x
x
x
x loop is over

3
x
x
x
x loop is over

5
x
x
x
x
x
x loop is over

4
x
x
x
x
x loop is over

4
x
x
x
x
x loop is over

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.