Why do we write this method after the variable, unlike len( )?


#1

Question

Why do we write this method after the variable, unlike len( )?

Answer

Some methods, like len( ), are built into Python and can be used on lots of different things. Others, like lower( ), belong to strings, and can only be used attached to strings, and that’s why you see them attached at the end of a string instead of being on their own with a string inside their parentheses. A lesson on this exact topic, with more detail, is coming up soon!


FAQ: Learn Python – Strings & Console Output – lower()
#2

I had noticed this earlier and got confused – did the wrong thing here…think it would be helpful to explain this earlier – hate having to get things wrong especially as you example on a previous screen showed lower followed by parens… Another thing which is confusing is why you have to put empty parens round things like this example print var.lower()
Not your fault - nature of the language but it needs stressing earlier.


#3

That is the challenge, to explain these concepts earlier on, you would overload learners with information like functions, methods, classes, instances and so on. Not a great idea either


#4

I completely agree. I feel like I was tricked into getting it wrong which is a really demotivating way to learn something new.

It’s not as if the information is really that complicated at this point. No need to hold back on the explanation until two cards later.