0

I have a input that the user types in something Example

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: Something SOMETHING SoMeThinG

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

Adriaan
  • 17,741
  • 7
  • 42
  • 75

2 Answers2

0

Just make everything lowercase and strip whitespace

Test.lower().strip()

Provided SOMETHING is in lowercase.

ifma
  • 3,673
  • 4
  • 26
  • 38
0
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()
True
>>>
O'Niel
  • 1,622
  • 1
  • 17
  • 35