# -*- coding: utf-8 -*-
import random
import datetime
start = datetime.datetime.now(
)flag =
true
second_award =
0third_award =
0four_award =
0five_award =
0six_award =
0no_award =
0total_number =
0#file_reslut = open("reslut.txt","a+",encoding="utf-8")
while flag:
list_red =
list_red_1 =
while
len(list_red)
<6:
#生成隨機彩票,6個紅球號碼
red = random.randint(1,
33)if red not
in list_red:
else
:pass
list_red.sort(
)#將6個號碼排序
blue = random.randint(1,
16)#隨機生成1個藍球號碼
while
len(list_red_1)
<6:
#搖號,隨機不重複6個紅球號碼
red_1 = random.randint(1,
33)if red_1 not
in list_red_1:
else
:pass
list_red_1.sort(
)#紅球號碼排序
blue_1 = random.randint(1,
16)#搖號,乙個藍球號碼
count =
0#判斷兩組雙色球號碼有幾個紅球是一樣的
for i in list_red:
if i in list_red_1:
count = count +
1else
:pass
#判斷該組雙色球號碼是否中獎,是几等獎
if count ==
6and blue == blue_1:
flag =
false
print
("一等獎中獎號碼:"
)print
(list_red,end=
" ")
print
(blue)
print
(list_red_1, end=
" ")
print
(blue_1)
elif count ==
5and blue == blue_1:
third_award = third_award +
1elif count ==
4and blue == blue_1:
four_award = four_award +
1elif count ==
3and blue == blue_1:
five_award = five_award +
1elif count ==
2and blue == blue_1:
six_award = six_award +
1elif count ==
1and blue == blue_1:
six_award = six_award +
1elif count ==
0and blue == blue_1:
six_award = six_award +
1elif count ==
6and blue != blue_1:
second_award = second_award +
1elif count ==
5and blue != blue_1:
four_award = four_award +
1elif count ==
4and blue != blue_1:
five_award = five_award +
1elif count ==
3and blue != blue_1:
no_award = no_award +
1elif count ==
2and blue != blue_1:
no_award = no_award +
1elif count ==
1and blue != blue_1:
no_award = no_award +
1elif count ==
0and blue != blue_1:
no_award = no_award +
1 total_number = total_number +
1print
("中二等獎的次數:"
+str
(second_award)
)print
("中三等獎的次數:"
+str
(third_award)
)print
("中四等獎的次數:"
+str
(four_award)
)print
("中五等獎的次數:"
+str
(five_award)
)print
("中六等獎的次數:"
+str
(six_award)
)print
("沒中獎的次數:"
+str
(no_award)
)print
("共買彩票次數:"
+str
(total_number)
)total = total_number *
2print
("共花費:"
+str
(total)
)award =
5000000
+ second_award*
2500000
+ third_award*
3000
+ four_award*
200+ five_award*
10+ six_award*
5print
("共獲得獎金:"
+str
(award)
)end = datetime.datetime.now(
)print
(end - start)
一等獎中獎號碼:[1
,5,12
,18,31
,33]4
[1,5
,12,18
,31,33
]4中二等獎的次數:11
中三等獎的次數:141
中四等獎的次數:6191
中五等獎的次數:108836
中六等獎的次數:825631
沒中獎的次數:13074475
共買彩票次數:14015286
共花費:28030572
共獲得獎金:393777150:
03:56.763208
讀寫壽命 你的固態硬碟讀寫多少次會失效?
今天我們準備研究一下硬碟是如何工作的,以及固態硬碟到底好在 在幾年前,絕大多數人用的都是機械硬碟,固態硬碟還是個奢侈且稀有的選項,但隨著技術的不斷成熟,固態硬碟正越來越普遍。全球出貨量有望在 2019 年歷史性地反超機械硬碟,是的,硬碟界的全民消費公升級馬上就要來了。相比機械硬碟,固態硬碟在讀寫速度...
不知道第多少次的自考總結
9 月份剛 答辯過,緊接著專案臨近上線,但每天還是需要準備自考,那段時間著實非常忙碌。希望最後的結果是完美的。課本算是過了兩遍,17 年 19 年的卷子,還有買的模擬卷子,感覺書中著實有寫內容不好理解,然後隨著做題的增加,對書中的有些內容還是慢慢的有所了解,但是覺得對於 c 這門課程來說感覺不僅僅是...
JS去重的幾種方法,並且知道重複多少次
let str 12qwe345671dsfa233dsf9876ds243dsaljhkjfzxcxzvdsf let arrays str.split 這個方法就是利用set沒有重複的值 arrays new set arrays join arrays a new set a arrays j...