P4B Quiz (12):字典資料型態介紹與使用

by KC
0 comment

Welcome to your quiz -「 P4B Quiz (12):字典資料型態介紹與使用

Name
Email
1. 
以下字典 (dictionary) 的鍵 (key) 是什麼?

{"a":1,"b":2}

2. 
以下執行結果是什麼?

Dict={"A":1,"B":"2","C":[3, 3, 3],"D":(5, 5, 5),'E':6,'F':7}
Dict["D"]

3. 
以下字典 (dictionary) 的值 (value) 是什麼?

{"Simple Learn":"2023", "pi day":"0314"}

4. 
以下執行結果是什麼?

my_dict = {0:"Simple", 1:"Learn", 2:"is", 3:"great"}
print(my_dict[1])

5. 
以下執行結果是什麼?

my_dict = {0:"Simple", 1:"Learn", 2:"is", 3:"great"}
print(my_dict.get(1))

6. 
以下執行結果是什麼?

my_dict = {0:"Simple", 1:"Learn", 2:"is", 3:"great"}
my_dict[0] = "Python"
print(my_dict[1])

7. 
以下執行結果是什麼?

my_dict = {0:"Simple", 1:"Learn", 2:"is", 3:"great"}
my_dict[0] = "Python"
print(my_dict.get(4))

8. 
以下執行結果是什麼?

my_dict = {0:"Simple", 1:"Learn", 2:"is", 3:"great"}
print(my_dict.pop(2))

9. 
以下執行結果是什麼?

my_dict = {0:"Simple", 1:"Learn", 2:"is", 3:"great"}
print(my_dict.popitem())

10. 
以下執行結果是什麼?

my_dict = {0:"Simple", 1:"Learn", 2:"is", 3:"great"}
my_dict.clear()
print(my_dict)

error: Content is protected !!