while statement not working when making simulation of montey hall problem

  Kiến thức lập trình
 from random import randrange
 k=input("pick a door 0,1,2: ")
 h=(randrange(3))
 while h==k:
     if h!=k:
         break
     h=(randrange(3))
 print(h)

why does this not make the output of h always different then k

this is the full code
from random import randrange
x=(randrange(3))
k=input(“pick a door 0,1,2: “)
h=(randrange(3))
while h==k:
if h!=k:
break
h=(randrange(3))
print(“I remove door”)
print(h)
j=input(“would you like to switch 1 if yes 2 if no: “)
if j==0:
if j==x:
print(“you win”)
else:
print(“you lose”)
else:
if j!=x:
print(“you win”)
else:
print(“you lose”)

New contributor

B1inded is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

1

LEAVE A COMMENT