What does Assigning a Value to a Variable Mean?

What does assigning a value to a variable mean ? Also, how does it help ,as we have already defined the variable with a specific name ?

1 Like

Hi @prembharwani,

A variable is just a way to point to a certain bit of memory in our computer. That memory can hold whatever we tell it to. If we change the value of a variable, all we’re doing is changing what the computer’s memory stores at the address the variable points to. Changing a variable’s value doesn’t change its name, though.

Does this make sense?

41 Likes

Wait I’m confused, so for putting a variable in I can’t put in today’s date? Just like a hint or something?

A variable can be just about anything, though the variable is just a name assigned to an object in memory.

The datetime module allows you to work with dates and times, including assigning a variable to the current date and time, which technically creates a datetime object in memory and assigns a variable to it.