<?xml version="1.0"?>
<rss version="2.0">
   <channel>
      <title>大樂透程式開發流程 by 20637蔡承洋</title>
      <link>https://padlet.com/s11030155/ql7m5nfdh49ua7eu</link>
      <description>111(2)高二C班課程</description>
      <language>en-us</language>
      <pubDate>2023-03-30 00:26:57 UTC</pubDate>
      <lastBuildDate>2025-12-31 00:19:01 UTC</lastBuildDate>
      <webMaster>hello@padlet.com</webMaster>
      <image>
         <url></url>
      </image>
      <item>
         <title>F1. 抽籤/取亂數</title>
         <author>s11030155</author>
         <link>https://padlet.com/s11030155/ql7m5nfdh49ua7eu/wish/2537479997</link>
         <description><![CDATA[<div>使用random函數<br><br><br><br><br>#*********************<br>#&nbsp; 高二進階程式設計 &nbsp; *<br>#&nbsp; 大樂透程式開發&nbsp; &nbsp; &nbsp;*<br>#&nbsp; 206-37-蔡承洋&nbsp; &nbsp; &nbsp; *<br>#&nbsp; &lt;抽籤/取亂數 &gt;&nbsp; &nbsp; &nbsp;*<br><br>#**********************<br>import random<br>list = []<br>a=1<br>while a&lt;=6:<br>&nbsp; &nbsp; b = (random.randrange(1, 101))<br>&nbsp; &nbsp; if b%2==0:<br>&nbsp; &nbsp; &nbsp; &nbsp; list.append(b)<br>&nbsp; &nbsp; &nbsp; &nbsp; a+=1<br>print(list)<br><br></div>]]></description>
         <enclosure url="https://onlinegdb.com/-d48pEpam" />
         <pubDate>2023-03-30 00:30:02 UTC</pubDate>
         <guid>https://padlet.com/s11030155/ql7m5nfdh49ua7eu/wish/2537479997</guid>
      </item>
      <item>
         <title>F2. 將亂數排序</title>
         <author>s11030155</author>
         <link>https://padlet.com/s11030155/ql7m5nfdh49ua7eu/wish/2537480584</link>
         <description><![CDATA[<div>加上sort函數<br><br><br><br><br>#*********************<br>#&nbsp; 高二進階程式設計 &nbsp; *<br>#&nbsp; 大樂透程式開發&nbsp; &nbsp; &nbsp;*<br>#&nbsp; 206-37-蔡承洋&nbsp; &nbsp; &nbsp; *<br>#&nbsp; &lt;六個數字的排序&gt;&nbsp; &nbsp; &nbsp;*<br>#**********************<br>import random<br>result = []<br>a=1<br>while a&lt;=6:<br>&nbsp; &nbsp; b = (random.randrange(1, 50))<br>&nbsp; &nbsp; if b%2==0:<br>&nbsp; &nbsp; &nbsp; &nbsp;result.append(b)<br>&nbsp; &nbsp; &nbsp; &nbsp;a+=1<br>&nbsp; &nbsp; &nbsp; &nbsp;<br>#氣泡排序<br>n=0 &nbsp; #宣告一個變數紀錄比較次數<br>for i in range(len(result)-1, -1, -1): &nbsp; #掃描輪數=元素個數-1<br>&nbsp; &nbsp; for j in range(i): &nbsp; #掃描各輪內之元素<br>&nbsp; &nbsp; &nbsp; &nbsp; if result[j] &gt; result[j+1]: &nbsp; #比大小<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result[j], result[j+1]=result[j+1], result[j] &nbsp; #大於就互換位置<br>&nbsp; &nbsp; &nbsp; &nbsp; n += 1&nbsp;<br>print(result) #輸出結果&nbsp; &nbsp;</div>]]></description>
         <enclosure url="https://onlinegdb.com/K_wbGsHH7" />
         <pubDate>2023-03-30 00:30:29 UTC</pubDate>
         <guid>https://padlet.com/s11030155/ql7m5nfdh49ua7eu/wish/2537480584</guid>
      </item>
      <item>
         <title> F3. 抽獎號碼不可以重覆</title>
         <author>s11030155</author>
         <link>https://padlet.com/s11030155/ql7m5nfdh49ua7eu/wish/2537480866</link>
         <description><![CDATA[<div>改用random.simple函數<br><br><br><br><br>#*********************<br>#&nbsp; 高二進階程式設計 &nbsp; *<br>#&nbsp; 大樂透程式開發&nbsp; &nbsp; &nbsp;*<br>#&nbsp; 206-37-蔡承洋&nbsp; &nbsp; &nbsp; *<br># &nbsp; &lt;號碼不重覆&nbsp; &gt;&nbsp; &nbsp; *<br>#**********************<br>import random<br>result = []<br>a = random.sample(range(1, 50), 6)<br>a.sort()<br>print(a)<br><br></div>]]></description>
         <enclosure url="https://onlinegdb.com/xvTZRaasR" />
         <pubDate>2023-03-30 00:30:42 UTC</pubDate>
         <guid>https://padlet.com/s11030155/ql7m5nfdh49ua7eu/wish/2537480866</guid>
      </item>
      <item>
         <title>F4. 產生 [N期] 的中獎號碼</title>
         <author>s11030155</author>
         <link>https://padlet.com/s11030155/ql7m5nfdh49ua7eu/wish/2537481216</link>
         <description><![CDATA[<div>加入while迴圈<br><br><br><br><br>#*********************<br>#&nbsp; 高二進階程式設計 &nbsp; *<br>#&nbsp; 大樂透程式開發&nbsp; &nbsp; &nbsp;*<br>#&nbsp; 206-37-蔡承洋&nbsp; &nbsp; &nbsp; *<br>#&nbsp; &lt;產生N期中獎號碼&gt;&nbsp; *<br>#**********************<br>import random<br>i = 0<br>n = int(input("需要N期號碼:"))<br>while i &lt; n:<br>&nbsp; &nbsp; result = []<br>&nbsp; &nbsp; a = random.sample(range(1, 50), 6)<br>&nbsp; &nbsp; a.sort()<br>&nbsp; &nbsp; print(a)<br>&nbsp; &nbsp; i += 1</div>]]></description>
         <enclosure url="https://onlinegdb.com/IcBPmEQGk" />
         <pubDate>2023-03-30 00:30:58 UTC</pubDate>
         <guid>https://padlet.com/s11030155/ql7m5nfdh49ua7eu/wish/2537481216</guid>
      </item>
      <item>
         <title>F5. 加上特別號 / 查詢期別</title>
         <author>s11030155</author>
         <link>https://padlet.com/s11030155/ql7m5nfdh49ua7eu/wish/2569492795</link>
         <description><![CDATA[<div>用陣列來查詢<br><br><br><br><br>#*********************<br># &nbsp; 高二進階程式設計&nbsp; &nbsp; *<br># &nbsp; 大樂透程式開發&nbsp; &nbsp; &nbsp; *<br># &nbsp; 206-37-蔡承洋&nbsp; &nbsp; &nbsp; &nbsp;*<br># &lt;加上特別號/ 查詢期別&gt;*<br>#**********************<br>import random<br><br>result = []<br>for i in range(10):<br>&nbsp; &nbsp; a = random.sample(range(1, 50), 6)<br>&nbsp; &nbsp; a.sort()<br>&nbsp; &nbsp; result.append(a)<br><br>&nbsp; &nbsp; b = random.sample(range(1, 50), 1)<br>&nbsp; &nbsp; while b in a:<br>&nbsp; &nbsp; &nbsp; &nbsp; b = random.sample(range(1, 50), 1)<br>&nbsp; &nbsp; result.append(b)<br><br>for i in range(10):<br>&nbsp; &nbsp; print(f"第{i+1}期中獎號碼：{result[i*2][0]}. {result[i*2][1]}. {result[i*2][2]}. {result[i*2][3]}. {result[i*2][4]}. {result[i*2][5]} / 特別號：{result[i*2+1][0]}")<br>&nbsp; &nbsp;&nbsp;<br>c = input("查詢第幾期:")<br>c = int (c)<br>print(f"第{c}期中獎號碼: {result[(c-1)*2][0]}. {result[(c-1)*2][1]}. {result[(c-1)*2][2]}. {result[(c-1)*2][3]}. {result[(c-1)*2][4]}. {result[(c-1)*2][5]} / 特別號：{result[(c-1)*2+1][0]}")<br><br><br><br></div>]]></description>
         <enclosure url="https://onlinegdb.com/qdy-ieEFl" />
         <pubDate>2023-04-27 00:21:01 UTC</pubDate>
         <guid>https://padlet.com/s11030155/ql7m5nfdh49ua7eu/wish/2569492795</guid>
      </item>
      <item>
         <title>F6. 單一期別/號碼的對獎</title>
         <author>s11030155</author>
         <link>https://padlet.com/s11030155/ql7m5nfdh49ua7eu/wish/2569497115</link>
         <description><![CDATA[<div>new bing超神<br><br><br><br><br>#*********************<br># &nbsp; 高二進階程式設計&nbsp; &nbsp; *<br># &nbsp; 大樂透程式開發&nbsp; &nbsp; &nbsp; *<br># &nbsp; 206-37-蔡承洋&nbsp; &nbsp; &nbsp; &nbsp;*<br>#&lt;單一期別/號碼的對獎 &gt; *<br>#*********************<br>import random<br><br>def generate_lottery_numbers():<br>&nbsp; &nbsp; # 產生十期的大樂透號碼<br>&nbsp; &nbsp; lottery_numbers = []<br>&nbsp; &nbsp; for i in range(10):<br>&nbsp; &nbsp; &nbsp; &nbsp; # 從 1 到 49 中隨機選出 6 個不重複的數字<br>&nbsp; &nbsp; &nbsp; &nbsp; numbers = random.sample(range(1, 50), 6)<br>&nbsp; &nbsp; &nbsp; &nbsp; # 將數字排序<br>&nbsp; &nbsp; &nbsp; &nbsp; numbers.sort()<br>&nbsp; &nbsp; &nbsp; &nbsp; # 將號碼加入列表中<br>&nbsp; &nbsp; &nbsp; &nbsp; lottery_numbers.append(numbers)<br>&nbsp; &nbsp; return lottery_numbers<br><br>def generate_special_number():<br>&nbsp; &nbsp; # 產生十期的特別號<br>&nbsp; &nbsp; return random.sample(range(1, 50), 10)<br><br>def check_lottery_numbers(lottery_numbers, special_numbers):<br>&nbsp; &nbsp; # 輸入要對獎的期數<br>&nbsp; &nbsp; period = input("請輸入你要對獎的期數：")<br>&nbsp; &nbsp; # 輸入你的六個數字（以逗號分隔）<br>&nbsp; &nbsp; numbers = input("請輸入你的六個數字（以逗號分隔）：")<br>&nbsp; &nbsp; # 將輸入的數字轉換為整數列表<br>&nbsp; &nbsp; numbers = list(map(int, numbers.split(",")))<br>&nbsp; &nbsp; count = 0<br>&nbsp; &nbsp; for number in numbers:<br>&nbsp; &nbsp; &nbsp; &nbsp; if number in lottery_numbers[int(period) - 1]:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; count += 1<br>&nbsp; &nbsp; if special_numbers[int(period) - 1] in numbers:<br>&nbsp; &nbsp; &nbsp; &nbsp; count += 1<br>&nbsp; &nbsp; if count &gt;= 3:<br>&nbsp; &nbsp; &nbsp; &nbsp; print("恭喜你中獎了！")<br>&nbsp; &nbsp; else:<br>&nbsp; &nbsp; &nbsp; &nbsp; print("很抱歉，你沒有中獎。")<br><br>lottery_numbers = generate_lottery_numbers()<br>special_numbers = generate_special_number()<br><br>while True:<br>&nbsp; &nbsp; print("以下是十期的中獎號碼和特別號：")<br>&nbsp; &nbsp; for i in range(10):<br>&nbsp; &nbsp; &nbsp; &nbsp; print(f"第 {i + 1} 期：{lottery_numbers[i]} 特別號：{special_numbers[i]}")<br><br>&nbsp; &nbsp; check_lottery_numbers(lottery_numbers, special_numbers)<br><br>&nbsp; &nbsp; answer = input("是否繼續對獎？（輸入 y 繼續，輸入 n 結束）")<br>&nbsp; &nbsp; if answer.lower() == "n":<br>&nbsp; &nbsp; &nbsp; &nbsp; print("感謝使用！")<br>&nbsp; &nbsp; &nbsp; &nbsp; break<br><br><br><br><br></div>]]></description>
         <enclosure url="https://onlinegdb.com/QjbpB-AVx" />
         <pubDate>2023-04-27 00:23:47 UTC</pubDate>
         <guid>https://padlet.com/s11030155/ql7m5nfdh49ua7eu/wish/2569497115</guid>
      </item>
   </channel>
</rss>
