FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!

re variables




In most computer languages the name of a variable represents a value of a given type stored in a fixed memory location. You change the value of a certain variable, but not the type. But in Python, it's different. Variables are typed dynamically. This is illustrated in the following session using the Python interpreter:

>>> var = 8 # var is integer type
>>> print var
8
>>> type(var) # type() function returns an object's type
<type 'int'>
>>> var = var * 3.0 # now var is float type
>>> type(var)
<type 'float'>
>>> print var
24.0



0 blog comments below




FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.