返回列表 發帖

串列 (一)

假設有一串列其內容如下:
list=["忠","孝","仁","愛","信","義","和","平"]

試取出串列中的第1到第5個元素
  1. list=["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:6])
複製代碼
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

  1. list=["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:6])
複製代碼

TOP

  1. list=["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:6])
複製代碼

TOP

  1. list1=[1,2,3,4,5,6,7,8,9]
  2. list2=["忠","孝","仁","愛","信","義","和","平"]
  3. list3=["看",1,2,"山"]
  4. print(list2[1:6])
複製代碼

TOP

  1. a=[1,2,3,4,5]
  2. b=['a','b','c','d','e']
  3. c=[1,'a',2,'b',3]
  4. print(a[0:6])
  5. print(a[0:5])
  6. print(a[2:4])
  7. print(b[2:4])
  8. print(c[2:4])
  9. print(a,b,c)
  10. print(b[1])
  11. print(a[1])
  12. print(c[1])
複製代碼

TOP

  1. list=["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:6])
複製代碼

TOP

  1. list=["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:6])
複製代碼

TOP

  1. list2=["0","1","2","3","4","5","6"]
  2. print(list2[1:6])
複製代碼

TOP

  1. list=["忠","孝","仁","愛","信","義"]
  2. print(list[1:6])
複製代碼

TOP

  1. list1=["忠","孝","仁","愛","信","義"]

  2. print(list1[1:6])
複製代碼

TOP

  1. list=["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:6])
複製代碼

TOP

  1. list=["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:6])
複製代碼

TOP

  1. list=["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:6])
複製代碼

TOP

  1. list1=["忠","孝","仁","愛","信","義","和","平"]
  2. print(list1[1:6])
複製代碼
陳頡鴻

TOP

  1. list=["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:6])
複製代碼

TOP

  1. list=["忠","孝","仁","愛","信","義","和","平"]
  2. print(list[1:6])
複製代碼

TOP

返回列表