Board logo

標題: 串列 (一) [打印本頁]

作者: tonyh    時間: 2022-1-27 09:54     標題: 串列 (一)

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

試取出串列中的第1到第5個元素

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

作者: 林柏諺    時間: 2022-1-27 10:49

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

作者: 尤宸于    時間: 2022-1-27 10:50

  1. list=[5,0,2,4,6,8,7,7,3]
  2. print(list[1:9:2])
複製代碼

作者: 胡孟涵    時間: 2022-1-27 10:52

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

作者: 張效騫    時間: 2022-1-27 10:53

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

作者: 黃裕恩    時間: 2022-1-27 10:54

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

作者: 張仲言    時間: 2022-1-27 10:55

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

作者: 富溢    時間: 2022-1-27 11:19

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

作者: 林柏勳    時間: 2022-1-27 11:46

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





歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/) Powered by Discuz! 7.2