官术网_书友最值得收藏!

Assigning variables

Since a variable is just a description of the underlying data, the data can change. For example, if you have a variable named time, you would expect its value to change every second. At any point, you can use the assignment operator = to assign a new value to a variable.

This code snippet explores this by creating a single variable, color, and assigning it three different values. The value of color is printed after each assignment:

color = "red"
print (color)
color = "green"
print (color)
color = "blue"
print (color)

The output from this program should look like this:

主站蜘蛛池模板: 迁西县| 思南县| 河池市| 奈曼旗| 察哈| 台前县| 明溪县| 靖州| 防城港市| 佛学| 龙陵县| 许昌县| 屏山县| 三门县| 皮山县| 永康市| 开阳县| 黄大仙区| 南涧| 宁武县| 右玉县| 淄博市| 长寿区| 思茅市| 蒙自县| 深水埗区| 西和县| 阿图什市| 安庆市| 金华市| 和顺县| 饶河县| 长乐市| 偃师市| 上林县| 阿克陶县| 海南省| 商城县| 宁波市| 宣武区| 乌什县|