+ 5

How to make python case insensitive

Suppose we have a variable of value "variable". We have to make it case insensitive so that the input can equal the value in any case.Like in this example pls hlp https://code.sololearn.com/c5gZqTsBcGOp/?ref=app

3rd May 2018, 5:52 AM
ᏳoƊoԲᎮc !
ᏳoƊoԲᎮc ! - avatar
5 odpowiedzi
+ 20
First watch this Video: https://www.bing.com/videos/search?q=how+to+make+JUMP_LINK__&&__python__&&__JUMP_LINK+case+insensitive&qpvt=how+to+make+python+case+insensitive&view=detail&mid=59BEBF5235B1BD7AA73C59BEBF5235B1BD7AA73C&&FORM=VRDGAR Second, Assuming ASCII strings: string1 = 'Hello' string2 = 'hello' if string1.lower() == string2.lower(): print "The strings are the same (case insensitive)" else: print "The strings are not the same (case insensitive)" SOURCE: https://stackoverflow.com/questions/319426/how-do-i-do-a-case-insensitive-string-comparison
3rd May 2018, 7:19 AM
Baraa AB
Baraa AB - avatar
+ 19
GodOfPC 611 most welcome bro 💙 Good luck 😉💚
3rd May 2018, 12:21 PM
Baraa AB
Baraa AB - avatar
+ 8
Rahul George : since there exists a challenge for it: casefold() as a further opportunity
3rd May 2018, 7:57 AM
Oma Falk
Oma Falk - avatar
+ 7
Thanks Baraa AB I got the point , pretty easy though😁👍 words will remain same in lowercase So it can be case insensitive 👏
3rd May 2018, 7:46 AM
ᏳoƊoԲᎮc !
ᏳoƊoԲᎮc ! - avatar
+ 5
You could possibly make use of the "your string".upper(), " your string".lower() or "your string". title() functions... https://www.google.co.in/url?sa=t&source=web&rct=j&url=https://stackoverflow.com/q/27770573&ved=2ahUKEwjdmImT9OjaAhWMKo8KHSuOAiEQFjADegQIBRAB&usg=AOvVaw3z5hbCWYsUF5HOewPIzNl1
3rd May 2018, 6:25 AM
Rahul George
Rahul George - avatar