- Hands-On Data Science and Python Machine Learning
- Frank Kane
- 183字
- 2021-07-15 17:15:01
Tuples
Tuples are just like lists, except they're immutable, so you can't actually extend, append, or sort them. They are what they are, and they behave just like lists, apart from the fact that you can't change them, and you indicate that they are immutable and are tuple, as opposed to a list, using parentheses instead of a square bracket. So you can see they work pretty much the same way otherwise:
#Tuples are just immutable lists. Use () instead of []
x = (1, 2, 3)
len(x)
The output of the previous code is as follows:
3
We can say x= (1, 2, 3). I can still use length - len on that to say that there are three elements in that tuple, and even though, if you're not familiar with the term tuple, a tuple can actually contain as many elements as you want. Even though it sounds like it's Latin based on the number three, it doesn't mean you have three things in it. Usually, it only has two things in it. They can have as many as you want, really.
- R語言數據分析從入門到精通
- Python機器學習:數據分析與評分卡建模(微課版)
- PySide GUI Application Development(Second Edition)
- Apex Design Patterns
- 琢石成器:Windows環境下32位匯編語言程序設計
- Getting Started with Hazelcast(Second Edition)
- Mastering React
- HoloLens與混合現實開發
- Vue.js應用測試
- C陷阱與缺陷
- ABAQUS6.14中文版有限元分析與實例詳解
- Python網絡爬蟲實例教程(視頻講解版)
- Implementing Domain:Specific Languages with Xtext and Xtend
- 虛擬現實:引領未來的人機交互革命
- Practical Time Series Analysis