Skip to content

Commit bfe38c6

Browse files
authored
선물 추첨 프로그램
1 parent 02c127b commit bfe38c6

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

gift_lottery.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import random
2+
import time
3+
4+
names = """나이스1
5+
나이스2
6+
나이스3
7+
나이스4
8+
나이스5
9+
나이스6
10+
나이스7
11+
나이스8
12+
나이스9
13+
나이스10
14+
나이스11
15+
나이스12
16+
나이스13
17+
나이스14
18+
나이스15
19+
나이스16
20+
나이스17
21+
나이스18
22+
나이스19
23+
나이스20
24+
나이스21
25+
나이스22
26+
나이스23
27+
나이스24
28+
나이스25"""
29+
30+
arr = names.split("\n")
31+
cnt = len(arr)
32+
33+
lottery_cnt = 5 #추첨 인원
34+
lottery_name = []
35+
for i in range(lottery_cnt):
36+
random.shuffle(arr)
37+
random.shuffle(arr)
38+
random.shuffle(arr)
39+
for i in range(100):
40+
print(f"\r{i}", end='')
41+
time.sleep(0.03)
42+
43+
s = arr.pop()
44+
lottery_name.append(s)
45+
print(f"\r추첨 --> {s}")
46+
time.sleep(3)
47+
48+
print()
49+
print("*"*20)
50+
print("선물 당첨자 명단")
51+
print("*"*20)
52+
no = 1
53+
for i in lottery_name:
54+
print(no, ":", i)
55+
no += 1

0 commit comments

Comments
 (0)