Store strings


#1

https://www.codecademy.com/courses/learn-python/lessons/strings--console-output/exercises/string-methods?action=lesson_resume

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?


#2

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.


#3

Python syntax for variable declaration:

name = "value"

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


#4

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


#5

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


#6

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


#7

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


#8

Creating a string

'blah'

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


#9

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


#10

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