June is Combung
구구단 게임[3단계] 본문
# 구구단 게임[3단계]
# 1. 구구단 게임을 5회 반복한다.
# 2. 정답을 맞추면 20점이다.
# 3. 게임 종료 후, 성적을 출력한다.
import random
count = 0
i = 1
while i <= 5:
x = random.randint(2, 9)
y = random.randint(1, 9)
answer = x * y
print(x, "X", y, "= ?")
my_answer = int(input("정답 입력 : "))
if answer == my_answer:
count = count + 1
print("정답")
else:
print("땡")
i = i + 1
score = count * 20
print("성적 =", score)
'python > 반복문' 카테고리의 다른 글
반복문 종료(-100) (0) | 2021.02.16 |
---|---|
영수증 출력[2단계] (0) | 2021.02.16 |
반복문 기본문제[2단계] (0) | 2021.02.16 |
반복문 기본문제[1단계] (0) | 2021.02.16 |
반복문 while (0) | 2021.02.16 |
Comments