Video 4: Variables & Expressions (page 2 of 7) |
Variables do not need to be declared with any particular object or data type. We can even change the object type after variables have been set. If you want to specify the data type of a variable at any time, you may explicitly cast it. For instance,
x = str('hello world')
x = str(1)
x = float(1)
x = int(x)
x = float(x*7)