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

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -