-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlay
30 lines (26 loc) · 966 Bytes
/
Play
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import random,time
class Play :
def __init__(self, number) :
self.number = number#생성자
self.numlist = random.choices(range(1,5), k=20)#랜덤난수 리스트
self.numlist_user = []#내가 입력한 리스트
def playGame(self, breaktime):
realBreak = True
global input
for round in range(len(self.numlist)):
for k in range(round):
print(self.numlist[k])
time.sleep(breaktime)
for j in range(round):
input= input('숫자 입력:')
if self.numlist[j] == input :
self.numlist_user.append(input)
continue
else :
realBreak = False
break
if (realBreak == False) :
print("숫자가 틀려 게임을 종료합니다.")
break
play =Play(3)
play.playGame(1)