<jupyter_start><jupyter_text>Tuple (配對) 不可改 一個包含多型別 可以同時多個賦值<jupyter_code>x = 10,20,30
y= 'Tom',12
print(x,y)
print(x[2])
print(y[1])
y[1] = 2 #不可改
a,b,c = 1,'Tom',True
print(a,b,c)<jupyter_output>1 Tom True<jupyter_text>List 可改 多型別一個 有序陣列<jupyter_code>x = [10,20,30]
y= ['Tom',12]
print(x,y)
print(x[2])
print(y[1])
y[1] = 2 #可改
print(y[1])
a,b,c = [1,'Tom',True]
print(a,b,c)
list = [1,2,3,4,5]
print(list)
list.append(6)
print(list)
list.insert(0,0)
print(list)
list.extend([7,8,9,10])
print(list)
list.remove(9)
print(list)
list.pop()
print(list)<jupyter_output>[1, 2, 3, 4, 5]
[1, 2, 3, 4, 5, 6]
[0, 1, 2, 3, 4, 5, 6]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 10]
[0, 1, 2, 3, 4, 5, 6, 7, 8]<jupyter_text>Lists slower but more powerful than tuples.Lists can be modified, and they have lots of handy operations we can perform on them.Tuples are immutable and have fewer features.We can always convert between tuples and lists using the list() and tuple() functions. functionli = list(tu),tu = tuple(li)  Dictionary<jupyter_code>movie = {
    "a":"asdfghjk",
    2:123,
    "aasd":3344,
    'star':[1,2,3,"Tom"],
    "sss":{
        "x":"d",
        "f":"ff",
        "z":{
            100:1223
        }
    }
}
print(movie)
print(movie['a'])
print(movie[2])
print(movie['star'][3])
print(movie['sss']['x'])
print(movie['sss']['z'][100])
#當 怕key不存在 可用.get處理
print(movie.get(55))
print(movie.get(55,100))#後面是不存在時的回傳
#更改
print(movie[2])
movie[2] = 1234
print(movie[2])<jupyter_output>{'a': 'asdfghjk', 2: 123, 'aasd': 3344, 'star': [1, 2, 3, 'Tom'], 'sss': {'x': 'd', 'f': 'ff', 'z': {100: 1223}}}
asdfghjk
123
Tom
d
1223
None
100
123
1234<jupyter_text>Set 保存的資料內容無順序 數學意義上的「集合」，因此資料內容不重複<jupyter_code>s1 = set()
print(s1)
s2 = {1,2,3,4}
print(s2)
s3 = set(range(5))
print(s3)
# 重複自動消失
s4 = {1,1,1,1,1,1,1,1}
print(s4)
#字元特性
s5 = set('asddfghhh')#只有這種情況
print(s5)
# 集合操作
s1 = set()
s2 = {1}
s3 = {1,2}
#包含
print(s1 <= s2)
print(s2 <= s3)
#在外
print(s1 >= s2)<jupyter_output>set()
{1, 2, 3, 4}
{0, 1, 2, 3, 4}
{1}
{'d', 'h', 'f', 'g', 'a', 's'}
True
True
False<jupyter_text>looking up item<jupyter_code>list = [1,2,3,4,5]
print(list[2])
print(list[-3])
print(list[0:3])
print(list[:3])
print(list[3:])
print(list[::2])
#copy list
listN = list #copy by reference
print(listN)
listN = list[:] #copy by value
print(listN)<jupyter_output>[1, 2, 3, 4, 5]
[1, 2, 3, 4, 5]
{'fraction_non_alphanumeric': 0.23051131601005867, 'fraction_numerical': 0.09681475272422464, 'mean_word_length': 5.152061855670103, 'pattern_counts': {'":': 6, '<': 18, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '562279', 'license': 'MIT', 'n_tokens_mistral': 1389, 'n_tokens_neox': 1275, 'n_words': 275, 'path': 'python_exercise/data_structure.ipynb', 'repo_name': 'leon123858/python_exercise', 'size': '2386'}