In order to randomly pick from all three-digit numbers shouldn't you start with 100 instead of 111?
You should also be aware that random.randint(a, b) returns a random integer N such that a <= N <= b This means that random.randint(111, 1000) can return 1000 (which is not three-digit)
You could take advantage of random.sample():
You should also be aware that random.randint(a, b) returns a random integer N such that a <= N <= b This means that random.randint(111, 1000) can return 1000 (which is not three-digit)
You could take advantage of random.sample():
>>> cisla = random.sample(range(100,1000), 3)Part of your problem is:
>>> a=[random.randint(111,1000)] # you create list with random int in it >>> a [433] >>> str(a) # you created string from list containing one int; didn't assign name '[433]' >>> a # a is still list with random three-digit int in it [433] >>> if 0 in a: # there can't be 0 in a as element because there can be three-digit integers onlyIn you code cisla is list of lists, something like:
[[457], [817], [844]]
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.