What situation would make you delete a variable and what would make you reassign dt same variable? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What situation would make you delete a variable and what would make you reassign dt same variable?

Python

15th Apr 2018, 8:43 AM
Robert Olubukunmi
Robert Olubukunmi - avatar
3 Answers
+ 2
Delete a variable if you found that it was never used/needed, for example, you write a code which required 3 variables, and later you find a way to do it with just 2 variables, the third one is no longer needed, you can then safely remove it. Value assignment or reassignment is common to happen throughout the execution period of codes, we reassign new value to a variable as necessary, for example in a loop the value of iterator variable is changing with every iteration, I'm not really sure this is your question, so if I misunderstood that second question, you can say something : )
15th Apr 2018, 8:58 AM
Ipang
+ 1
no you didn't.... thanks for explaining to me. I appreciate a lot.
15th Apr 2018, 9:03 AM
Robert Olubukunmi
Robert Olubukunmi - avatar
+ 1
You're welcome @Robert, I am glad if it was within context then : )
15th Apr 2018, 9:06 AM
Ipang