import random
words = ['사과', '강아지', '그림자', '복권', '구름']
start = words[random.randint(0,4)]
turn = 0
print("--- 끝말잇기 ---")
print(start, " ->")
run = True
while run:
new = ""
if turn % 2 == 0:
new = input("p1: ")
elif turn % 2 == 1:
new = input("p2: ")
# check
if start[len(start)-1] != new[0]:
if turn % 2 == 0:
print("P2가 이겼다.")
else:
print("P1이 이겼다.")
print("GAME OVER!")
break
else:
start = new
turn += 1
print("--------------")
'Python > ☞' 카테고리의 다른 글
[52]-A. 단어 맞추기 (0) | 2020.07.29 |
---|---|
[52] 단어 맞추기 (0) | 2020.07.29 |
[51] 끝말잇기 게임 (0) | 2020.07.29 |
[50] 문자열 : split() 분할함수 (0) | 2020.07.29 |
[49] 연습문제 : 문자열 (0) | 2020.07.29 |
댓글