Hi I'm an intermediate python user and I came across this strange bug. I tested it on both a Mac and Windows 10 computer and got the same results.
Here is my code:
def t1(time):
return '21:00:00' < time
def t2(time):
return '05:00:00' > time
def runScript(time):
return '21:00:00' < time or '5:00:00' > time
def runScript2(time):
return t1(time) or t2(time)
t = '15:00:00'
print(t1(t))
print(t2(t))
print(runScript(t))
print(runScript2(t))
Here are my results:
False
False
True
False
This is what I get running it straight from the interpreter
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> def t1(time):
... return '21:00:00' < time
...
>>> def t2(time):
... return '05:00:00' > time
...
>>> def runScript(time):
... return '21:00:00' < time or '5:00:00' > time
...
>>> def runScript2(time):
... return t1(time) or t2(time)
...
>>> t = '15:00:00'
>>>
>>> print(t1(t))
False
>>> print(t2(t))
False
>>> print(runScript(t))
True
>>> print(runScript2(t))
False
>>> exit()
Thank you!