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

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

Voters
Profile icon
WyattKinzer1
Profile icon
k9chelsea2
Profile icon
InvisibleOne
Profile icon
JordynCarroll
Comments
hotnewtop
Profile icon
dof

3

Profile icon
WyattKinzer1

for when it asks for your name dont forget to put a space after the question mark in the code. it will make it look better and not smushed into the question. but this was pretty cool. ps, I make this mistake all the time to. :)

Profile icon
JordynCarroll

@k9chelsea2
Thank You!

Profile icon
JordynCarroll

@Axrevyn
Thank You!

Profile icon
InvisibleOne

cool, but like

@Axrevyn
said, you should use .lower()

Profile icon
Axrevyn

@InvisibleOne
grrrr I was summoned

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).

Profile icon
k9chelsea2

cool