返回列表 發帖

for 迴圈 (一)


#for i in [list的資料型態]

#range(start=0,stop,step=1)

#range(1,6)->[1,2,3,4,5]
#range(5)->[0,1,2,3,4]
#range(1,5)->[1,2,3,4]
#range(1,5,2)->[1,3]


直向顯示第1名~第5名

  1. for i in range(1,6):
  2.     print("第",i,"名")
複製代碼

  1. for i in range(1,6):
  2.     print("第",i,"名")
複製代碼

TOP

  1. for i in range(1,6):
  2.     print("第",i,"名")
複製代碼

TOP

  1. for i in range(1,6):
  2.     print("第",i,"名")
複製代碼

TOP

  1. for in range(1,6):
  2.     print("第",i,"名")
複製代碼

TOP

  1. for i in range(1,6):
  2.     print("第",i,"名")
  3.    
複製代碼

TOP

  1. for i in range(1,6):
  2.     print("第",i,"名)
複製代碼

TOP

  1. for a in range(1,6):
  2.     print(f"第{a}名")
複製代碼

TOP

for i in range(1,6):
print("第",i,"名")

TOP

返回列表