1. 程式人生 > >python全棧開發筆記---------變數小結

python全棧開發筆記---------變數小結

變數是什麼?

           變:變化,重在變字,量:計量,衡量,表示一種狀態。

           變數字面理解就是一個可能改變的量,也就是這個值是不固定的。

變數名:

          a.數字

          b.字母

          c.下劃線

變數的定義

    level = 1 

    level : 變數名, = :賦值符號,1 :值

   PS:

          1.數字不能開頭

          2.不能用關鍵字:(檢視所有的關鍵字:help("keywords"))

Here is a list of the Python keywords.  Enter any keyword to get more help.

and                 elif                import              return
as else in try assert except is while break finally lambda with class for not yield continue from or
def global pass del if raise

       3.不要和python內建的東西重複 。 比如sum  。雖然他不是關鍵字。 但是他是系統內建的,如果用它變量了。 那麼就破壞了系統內建的功能了。

       4.變數名儘量有意義。(變量表示的某種意義)