Python strings - general


Replace this line with your code.


Just started to use CA. Its nice but it doesn't explain why.
why len is like this: len(string)
and lower() is like this: string.lower()


Hi, @at_1965 ,

len is a Python built in function that can be used with several different types of objects, including lists and strings. To use the function, we pass it an argument enclosed within parentheses.

In contrast, lower is a method that defined as part of the str type, which represents strings. To call a method, we typically use dot notation, which consists of an object, followed by a dot, followed by the name of the method, and finally by parentheses, containing any arguments, if any, to be passed to the method. This concept will become clearer in later Python exercises, especially the ones focusing on classes.


Hi @appylype

I'm still new to Code academy, so please forgive me if this is not the place for my question.
I just would like to know the difference in placing a string between a single quotation mark, and a double quotation mark in Python. When would we need to use the one or the other.

Thank you [ :


Hi, @netrunner10450 ,

Strings delimited by single or double quotes around it are equivalent, if they have the same content. But, after completing Exercise 3: Escaping characters, consider the various choices you have for creating a string that contains either double or single quotes inside it.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.