0

I want to make if comparisons not care about the capitals.

I have tried to Google this but nothing shows up with the answer im looking for.

Example Code:

word = input()
if word == 'banana':
    print("Apples")
zabop
  • 6,750
  • 3
  • 39
  • 84
CM3K
  • 1
  • 1
  • 1

3 Answers3

0

Can do:

word = input()
if word.lower() == 'banana':
    print("Apples")

Also recommend: How do I do a case-insensitive string comparison?

zabop
  • 6,750
  • 3
  • 39
  • 84
0

Use the built-in lower() function like this:

word = input()
if word.lower() == 'banana':
    print("Apples")
Tom Gebel
  • 744
  • 1
  • 4
  • 13
0

You could transform input to lowercase like this:

word = input()
if word.lower() == 'banana':
    print("Apples")
willcrack
  • 1,794
  • 11
  • 20
Matheus Delazeri
  • 425
  • 2
  • 15