自變量命名規則
可以將一個數值,或者字符串串附值給自變量,如apple=1
中,apple
爲自變量的名稱,1
爲自變量的值。 也可以將字符串賦值給自變量 apple='iphone7 plus'
apple=1 #賦值 數字
print(apple)
""""
1
""""
apple='iphone 7 plus' #賦值 字符串
print(apple)
""""
iphone 7 plus
""""
如果需要用多個單詞來表示自變量,需要加下劃線,如apple_2016='iphone 7 plus'
請看代碼
apple_2016='iphone 7 plus and new macbook'
print(apple_2016)
""""
iphone 7 plus and new macbook
""""
一次定義多個自變量 a,b,c=1,2,3
。
a,b,c=11,12,13
print(a,b,c)
""""
11 12 13
""""