Store strings


In this lesson,it says" Now that we know how to store strings."But I don’t think I know it.
So,how to store strings?


The concept of storing strings was covered extensively in the previous lessons. If you are still struggling with this concept, then I highly recommend you go back and recomplete the previous lessons.


Python syntax for variable declaration:

name = "value"

What does this tell you about storing strings? Try reviewing a previous lesson.


I revisited the previous lessons. Can I think of the assignment as storing strings?


I reviewed the previous lessons.Can I think of this as a way to store strings?


If by “assignment”, you mean the assignment of a string to a variable, such as in the example given by @825orion , then yes.


Yeh, that’s what I mean.Thanks a lot.


Creating a string


Will allocate memory for it. So the storing part is actually managed by python in the background.

When you assign a variable name to your value, python increments (adds 1) to the value’s reference counter. This is how python tracks whether you still care about the value or not. When this counter reaches 0, python knows it can remove the value.

Variables don’t store the values, they only store locations of values


Oh, thank you, you gave me a better understanding of what it means to store strings.


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