TrapdoorSmoke TrapdoorSmoke - 1 year ago 151
Python Question

Python if statement no cap check

I have a input that the user types in something

Test = input( 'Type in something' )
if Test == 'SOMETHING' :
print( 'You idiot!' )

How do I ignore the if the word something is in all caps or non caps example:

Sorry My Grammar is so bad It's hard to word these things

Answer Source
if Test.upper() == "something".upper(): print("You idiot")

What about making the two parts of the equatation upper/lower?

Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> Test = input("type in something ")
type in something SomeTHING
>>> Test.upper() == "something".upper()
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download