Python random number excluding one variable -
is possible create variable random number except 1 number stored in variable?
for example:
import random x = raw_input("number: ") y = random.randint(1,6)
so variable x
never y
try this:
import random x = int(raw_input("number(1-6): ")) # note made x int while true: y = random.randint(1, 6) if x != y: break
Comments
Post a Comment