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

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:

主站蜘蛛池模板: 莱阳市| 冷水江市| 海阳市| 瑞安市| 灵石县| 新宾| 长治县| 北辰区| 阳西县| 河池市| 沈阳市| 原平市| 永川市| 稷山县| 封开县| 靖江市| 油尖旺区| 神农架林区| 南陵县| 安西县| 鄢陵县| 合阳县| 景宁| 延寿县| 虞城县| 永德县| 五峰| 讷河市| 固阳县| 南昌市| 嘉兴市| 太和县| 汨罗市| 大新县| 合川市| 怀集县| 淮北市| 沽源县| 军事| 泽普县| 黔江区|