#Python 3.X 程式語言特訓教材 6-42頁
import random
def lotto():
lottoLst=[]
cnt=0
while cnt <6 :
lottoNum = random.randint(1,49)
if lottoNum not in lottoLst:
lottoLst.append(lottoNum)
cnt += 1
lottoLst.sort()
print(lottoLst)
def main():
for i in range(1,6): #i=1,2,3,4,5
lotto()
main()

#綜合範例14
import random
randLst=[]
for i in range(100):
randNum = random.randint(1,1000)
randLst.append(randNum)
#print(randLst)
randLst.sort()
for j in range(1,101):
if j%10 == 0: print(“%4d” %randLst[j-1])
else:print(“%4d” %randLst[j-1],end=””)
print()
print(randLst[1])
print(randLst[-2])

#6-47:







![Python如何讀取excel檔(.xlsx)?如何用欄標籤提取某一直行?df=pandas.read_excel() ; df[“欄標籤”] Python如何讀取excel檔(.xlsx)?如何用欄標籤提取某一直行?df=pandas.read_excel() ; df[“欄標籤”]](https://i0.wp.com/savingking.com.tw/wp-content/uploads/2022/11/20221109163631_39.png?quality=90&zoom=2&ssl=1&resize=350%2C233)



近期留言