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

Printing variables

How can you tell what the value of a variable is? One way is to print the value out to the console. To print the value of a variable, you first type the keyword print, then the name of the variable between parentheses (). The full syntax is:

print (<variable>)

For example, we can check the value assigned to foo with the following code:

foo = "bar"
print (foo)

The first line of code creates a variable named foo and assigns it the string value "bar". The second line prints the value of the foo variable. This means bar will be printed to the console:

Where does the print keyword come from? What's a keyword? Why do we use parentheses when using print? These questions will be answered in the Functions section of this chapter.
主站蜘蛛池模板: 鹰潭市| 个旧市| 德钦县| 高安市| 龙陵县| 阿勒泰市| 朝阳区| SHOW| 黄陵县| 互助| 逊克县| 石狮市| 龙海市| 图们市| 怀安县| 西青区| 双流县| 乾安县| 天峨县| 辉南县| 哈巴河县| 海晏县| 天全县| 普陀区| 萨嘎县| 松溪县| 特克斯县| 定南县| 泸定县| 瑞丽市| 仪征市| 玛多县| 镇赉县| 永兴县| 河西区| 将乐县| 丹江口市| 三都| 九江市| 金沙县| 广西|