#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 pandas.DataFrame去重:df.drop_duplicates() 與 df[~df.duplicated()] 的等價、差異與最佳實踐 一文搞懂Python pandas.DataFrame去重:df.drop_duplicates() 與 df[~df.duplicated()] 的等價、差異與最佳實踐](https://i2.wp.com/savingking.com.tw/wp-content/uploads/2025/08/20250808202701_0_66f9bc.png?quality=90&zoom=2&ssl=1&resize=350%2C233)






近期留言