標題:
for 迴圈 (二)
[打印本頁]
作者:
陳品肇
時間:
2020-2-2 11:22
標題:
for 迴圈 (二)
假設有一串列其內容如下:
list=["忠","孝","仁","愛","信","義","和","平"]
試以for迴圈,橫向顯示串列中的所有元素。
[attach]8364[/attach]
list=["忠","孝","仁","愛","信","義","和","平"]
for s in list:
print(s,end=" ")
複製代碼
list=["忠","孝","仁","愛","信","義","和","平"]
for i in range(0,8):
print(list[i],end=" ")
複製代碼
作者:
陳頡鴻
時間:
2020-2-2 13:32
listai1=["忠","孝","仁","愛","信","義","和","平"]
for s in listai1:
print(s,end=" ")
複製代碼
listai2=["忠","孝","仁","愛","信","義","和","平"]
for i in range(0,8):
print(listai2[i],end=" ")
複製代碼
作者:
李穎俊
時間:
2020-2-2 13:33
list=["忠","孝","仁","愛","信","義","和","平"]
for s in list:
print(s,end=" ")
複製代碼
list=["忠","孝","仁","愛","信","義","和","平"]
for i in range(0,8):
print(list[i],end=" ")
複製代碼
作者:
黃紹綸
時間:
2020-2-2 13:33
list=["忠","孝","仁","愛","信","義","和","平"]
for s in list:
print(s,end=" "
複製代碼
list=["忠","孝","仁","愛","信","義","和","平"]
for i in range(0,8):
print(list[i],end=" ")
複製代碼
作者:
黃紹恩
時間:
2020-2-2 13:34
list=["忠","孝","仁","愛","信","義","和","平"]
for i in range(0,8):
print(list[i],end="")
複製代碼
作者:
曾柏忻
時間:
2020-2-2 13:34
list=["忠","孝","仁","愛","信","義","和","平"]
for I in list:
print(I,end="")
print()
list=["忠","孝","仁","愛","信","義","和","平"]
for i in range(0,8):
print(list[i],end="")
複製代碼
作者:
陳沛頤
時間:
2020-2-2 13:34
list1=["忠","孝","仁","愛","信","義","和","平"]
for i in list:
print(i,end=" ")
print()
list=["忠","孝","仁","愛","信","義","和","平"]
for i in range(0,8):
print(list[i],end=" ")
複製代碼
作者:
潘堉恩
時間:
2020-2-2 13:35
list=["忠","孝","仁","愛","信","義","和","平"]
for s in list:
print(s,end=" ")
print()
list=["忠","孝","仁","愛","信","義","和","平"]
for i in range(0,8):
print(list[i],end=" ")
複製代碼
作者:
許雅棟
時間:
2020-2-2 13:37
list=["忠","孝","仁","愛","信","義","和","平"]
for y in list:
print(y,end="!")
print()
list=["忠","孝","仁","愛","信","義","和","平"]
for x in range(0,8):
print(list[x],end="~")
複製代碼
作者:
傅品翰
時間:
2020-2-2 13:37
list=["忠","孝","仁","愛","信","義","和","平"]
for s in list:
print(s,end=" ")
list=["忠","孝","仁","愛","信","義","和","平"]
for i in range(0,8):
print(list[i],end=" ")
複製代碼
作者:
曾顗文
時間:
2020-2-2 13:38
[code][code]list=["忠","孝","仁","愛","信","義","和","平"]
for s in list:
print(s,end=" ")
複製代碼
[/code][/code]
list=["忠","孝","仁","愛","信","義","和","平"]
for i in range(0,8):
print(list[i],end=" ")
複製代碼
作者:
林奇陞
時間:
2020-2-2 13:38
list=["忠","孝","仁","愛","信","義","和","平"]
for i in range(0,8):
print(list[i],end=" ")
複製代碼
作者:
黃柏叡
時間:
2020-2-2 13:40
list=["忠","孝","仁","愛","信","義","和","平"]
for i in list:
print(i,end=" ")
print()
for a in range(0,7):
print(list[a],end=" ")
複製代碼
作者:
林依玟
時間:
2020-2-2 13:40
list=["忠","孝","仁","愛","信","義","和","平"]
for s in list:
print(s,end=" "
複製代碼
作者:
傅英哲
時間:
2020-2-2 13:40
list=["忠","孝","仁","愛","信","義","和","平"]
for s in list:
print(s,end="")
print()
list=["忠","孝","仁","愛","信","義","和","平"]
for i in range(0,8):
print(list[i],end="")
複製代碼
作者:
林依玟
時間:
2020-2-2 13:41
list=["忠","孝","仁","愛","信","義","和","平"]
for i in range(0,8):
print(list[i],end=" ")
複製代碼
作者:
黃柏叡
時間:
2020-2-2 14:34
list3=range(1,100,2)
for i in list3:
print(i,end=" ")
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2