-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path과제 2번.py
More file actions
53 lines (44 loc) · 1.59 KB
/
과제 2번.py
File metadata and controls
53 lines (44 loc) · 1.59 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import random
rsp = ['가위', '바위', '보']
x, y, z = 0, 0, 0
while True:
com = random.choice(rsp)
print('가위바위보 게임을 합시다!')
while True:
player = input('가위, 바위, 보! 중에 선택해 주세요! ')
if player not in rsp:
continue
if player == com:
print('비겼습니다.')
z += 1
break
else:
if com == '가위':
if player == '바위':
print('플레이어 승리!')
x += 1
else:
print('플레이어 패배')
y += 1
elif com == '바위':
if player == '보':
print('플레이어 승리!')
x += 1
else:
print('플레이어 패배')
y += 1
elif com == '보':
if player == '가위':
print('플레이어 승리!')
x += 1
else:
print('플레이어 패배')
y += 1
break
game_replay = input('계속 하고싶다면 아무키나 입력해 주세요! 만약 그만하고 싶다면 no를 입력해주세요. ')
if game_replay.lower() == 'no':
print('게임을 종료합니다.')
print(f'매치 결과: 승리{x} 패배{y} 무승부{z}')
break
else:
print(f'지금까지 매치 결과: 승리{x} 패배{y} 무승부{z} 입니다.')