If you delete a variable will everything you've done previously with the variable (before you changed it) change as well? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

If you delete a variable will everything you've done previously with the variable (before you changed it) change as well?

1st Sep 2016, 2:54 PM
DELETED
3 Antworten
+ 2
Nope wont, kind of reassigning it
14th Jan 2017, 11:38 PM
Duniya Naphtali Kazahshi
Duniya Naphtali Kazahshi - avatar
+ 1
python is unlike c or other languages,.. where a value get assigned to a variable.. in python values are considered as objects and the variables get referred to the objects.. instead of assignment .. for better explanation, plz look at http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#other-languages-have-variables
2nd Sep 2016, 4:26 AM
arvindh
arvindh - avatar
0
it depend on assigning and what do you use ? example: a = 5 b = 6 c = a + b print(c) del a #print(a+b) #<--- if you use this, it will find a #then NameError occur because you already del a #print(c) #<--- if you use this , it will call c
1st Sep 2016, 5:47 PM
beauty1234