Difficulty: Lv ★ | Prerequisite Knowledge: Basic Weeks 4-5 + Week 9 (Functions)
Goal
Guess a random number between 1~N — attempt limit + difficulty selection
Differences from Basic Assignment
- Basic Week 5 = simple addition Large/Small + number of attempts
- Here = attempt limit + difficulty selection + retry option + function separation
Requirements
- Select difficulty at the start (Easy 1
50/7-times, Normal 1100/7-times, Hard 1~500/10-times) - Hint + remaining attempts for each try
- Reveal answer if attempts exceeded
Input/Output Example
Difficulty (1. Easy 2. Normal 3. Hard): 2
Guess a number from 1 to 100 within 7 tries
[Remaining 7 tries] Number: 50 → Higher number
[Remaining 6 tries] Number: 75 → Lower number
[Remaining 5 tries] Number: 63 → Correct! (3 tries)
One more time? (y/n): n
Challenge Task
- Save best record file
- User sets the answer and computer tries to guess
Execution
python solution.py
Grading Checklist
- Difficulty selection
- Attempt limit
- Separate into 3 or more functions