Skip to content
How many letters are in your name?
Profile icon
JordynCarroll

How many letters do you have in your name? :P

You are viewing a single comment. View All
Profile icon
Axrevyn

Not to nitpick. It took a while for me to realize what len() did, so props to you.
But .lower() is your friend.
In short, any variable with .lower() attached to the end will be converted to all lowercase letters. Perfect if you want to keep things non-case sensitive.

Here's some example code:

feeling = input("How are you feeling?") if feeling in ["good", "Good", "GOOD", "fine", "Fine", "FINE", "great", "Great", "GREAT"]: print("That's good!")

That's a little painful to read. But this version of the code:

feeling = input("How are you feeling?") if feeling.lower() in ["good", "fine", "great"]: print("That's good!")

All you had to do was add .lower(). It's easy and it makes your code less cluttered (and it's easier to type).