python基礎----變數

變數

變數是一個容器,用於存儲數據到記憶體,方便後面需要用到時直接調用變數的名稱即可

 

變數規則

  1. 變數名只能是 字母、數字或下劃線的任意組合
  2. 變數名的第一個字元不能是數字
  3. 以下關鍵字不能聲明為變數名
  4. ['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield']

 

變數賦值 

age = 18

name = "irene"