MonLes
MonLes

嘗試從都市叢林回到魔法森林。 更多作品 | https://linktr.ee/monles

Python — Part 02




基礎檔案類型Data Types

  • int
  • float
  • bool
  • str
  • list
  • tuple
  • set
  • dict

類別Classes (客製類型 custom types )

  • 你可為class客製名稱

特殊檔案類型(Specialized Data Types)





repl.it | Try it





更多python數學函式 | Here



變數(Variables)

  • 蛇行命名法(snake_case)
  •  — 使用底線( uderscore,如: var_001)
  • 使用小寫(lowerCase)或底線( underscore)當命名開頭
  • 字母、數字和底線都可以使用來命名變數
  • 大小寫敏感(Case sensitive)
  • --同樣的字,不同大小寫就是不同的變數
  • 不能覆寫(overwrite)關鍵字(keywords)
  • --如var就是python的關鍵字,不能再命名一個叫var的變數


關鍵字(Keywords)

每個語言都有先被預訂的特殊字彙們,統稱關鍵字。他們有特殊意義和限制,早已有一套規則。

所以他們無法用於變數名稱( names)、函式名稱( function names)和其他識別字(identifiers)

更多資訊|

https://realpython.com/python-keywords/

https://www.w3schools.com/python/python_ref_keywords.asp



陳述statement

var number = 50 / 5

表達expression

50 / 5


增量賦值運算器Augment assignment operator

some_value = 5
some_value -= 2
print(some_value)

如果覺得我的文章有幫助 👏 可以多按下面的按鈕幫我拍拍手 👇

🤖我也有在FAUN發表英文版教學文章喔! 💪

🚀Developers: Learn and grow by keeping up with what matters, JOIN FAUN.


CC BY-NC-ND 2.0 版权声明

喜欢我的文章吗?
别忘了给点支持与赞赏,让我知道创作的路上有你陪伴。

加载中…
加载中…

发布评论