Lesson 4


Isn't this "my_int" redefined?


Yes, it is. :slightly_smiling:

The programme runs from above, down the lines one by one:

first you define my_int as 7:

my_int = 7

then you change it on line 8 to 3:

my_int = 3

which makes my_int 3 in the end, because it didn't change after that.


what is the question? my_int was 7 (line 4), then you changed it to 3 (line 8), then it prints 3 (line 13), so your variable is redefined


Indeed. The interpreter reads just like you'd read a book!

That is, if you're American :wink:

You'll learn later that you can override variables to give them new values..

Here is an example of this in action:

# declaring the variable "dog_name" and assinging it a value for the first time
dog_name = "Moe"

# this is where you will override the "dog_name" variable with a  new value
dog_name = "Frank"

Hope this helps! :slightly_smiling:


He's just confirming that, as is it, the my_int variable is indeed being redefined! :wink:


Thank you all guys ! I was confused before cause this way I tried in C++ couldn't work.


you use int to declare a integer, if you want to overwrite you should just do:

a = 8;

no need to use int


I see. Thanks a lot.:relaxed:


This post was flagged by the community and is temporarily hidden.