숫자 맞추기 |
|||||
|---|---|---|---|---|---|
| 이름 | 이태수 | 등록일 | 25.12.24 | 조회수 | 4 |
|
import random def number_guessing_game(): print("=== 숫자 맞추기 게임 ===") number = random.randint(1, 100) attempts = 0 while True: guess = input("1~100 사이 숫자를 맞춰보세요: ") if not guess.isdigit(): print("숫자를 입력해주세요.") continue guess = int(guess) attempts += 1 if guess < number: print("UP") elif guess > number: print("DOWN!") else: print(f"??{attempts}번 만에 맞췄어요.") break number_guessing_game() |
|||||
| 이전글 | 가위바위보 |
|---|---|
| 다음글 | 타자 게임.py |