Im working with python 3.6 and I wrote this:
zen = 1
zen2 = True
def test():
if zen == 1 and zen2 == True:
print ("hello")
global zen2
zen2 = False
else:
print ("hello 2")
test()
...and the output is NOTHING! NADA! No "hello" nor "hello 2", not even an error!
Even if I do this:
zen = 1
zen2 = True
def test():
if zen == 1 :
if zen2 == True:
print ("hello")
global zen2
zen2 = False
else:
pass
else:
print ("hello 2")
test()
Still NOTHING! Why?
Edit: I'm sorry everyone, before this I didn't notice the "else" does not have a colon,so for some they got a Syntax error, its probably fixed now,but it still outputs nothing
Edit 2: this is going to be embarrassing, as since i was using PyCharm and my other file is open (in the file, no function is executed), i accidentally ran the other file rather than the this "zen" file,so i got nothing because it. I actually got a SyntaxError from this "zen" file and this post really helped me with the problem even though I stated that was not the problem, and it also reminded myself to double check everything before doing anything, so yeah, thanks for anyone who helped me :)