def specificChecker(someThing, checker):
if checker == None:
return someThing
elif checker == True:
return not someThing
else:
return None
def whatDoesTheCheckerSay(someThing):
if specificChecker(someThing) == someThing:
return 'The checker value was False on that one.'
elif specificChecker(someThing) == not someThing:
return 'The checker value was True on that one.'
elif specificChecker(someThing) == None:
return 'Something irregular happend. The checker value wasn\'t None or True.'
else:
return 'Something went really wrong. This doesn\'t even not work.'
reallySomeThing = input('Type in really some thing: ')
theChecker = input('Set the checker to something: ')
print(specificChecker(reallySomeThing, theChecker))
print(whatDoesTheCheckerSay(reallySomeThing)) # This can be made more efficient, right?
def one(someShit):
return someShit + ' AWWW YEAH!'
def two(someShit):
return one(someShit)
print(two(input('Type in some kind of stuff: ')))
I'm a self-taught beginner, so surely it's something awkwardly basic. I'm using the IDLE shell and have repeatedly gotten a syntax error at the second definition statement of my codes. Please help?
== not something, it should be!= somethingoris not somethingisand just say "similar to==".ismeans identity testing;x is yonly ifxandyare references to the exact same object. In general, you only useiswith language specified singletons (None,NotImplemented,Ellipsis, but notTrue/False, even though they're singletons, PEP8 recommends implicit truth testing for good reasons), types (if you want an instance of a specific class, but not subclasses thereof,type(obj) is MyClass), and sentinels (sentinel = object(); val = mydict.get(key, sentinel); if val is not sentinel:).