Variables

来源:互联网 发布:淘宝大股东是日本人 编辑:程序博客网 时间:2024/05/18 01:14
Variables

One of the most basic concepts in computer programming is the variable. A variable is a word/identifier that hangs onto a singlevalue. For example, let's say you needed the number 5 for your program, but you're not going to use it immediately. You can set a variable, say spam, to grab the value 5and hang onto it for later use, like this:

spam = 5

Declaring variables in Python is easy; you just write out a name/identifier, like spam, and use = to assign it a value, and you're done!

原创粉丝点击