if and elif satements in a while loop (in a function) is not changing a variable declared in the function [closed]
You are setting opened = True
, but you will overwrite it in the next loop iteration with opened = False
.
You will need to initialize variables before the while
loop.
Also, there is no need to use global
here.