Exercise: Hello Claude¶
Level: Beginner Time: 15-20 minutes Skills: Basic commands, file operations, running code
Objective¶
Get comfortable with Claude Code by creating, modifying, and running a simple program.
Setup¶
-
Navigate to this exercise directory:
-
Start Claude Code:
Tasks¶
Complete these tasks using only Claude Code (don't edit files manually):
Task 1: Create a Greeter¶
Ask Claude to create a file called greeter.py that:
- Asks for the user's name
- Prints a personalized greeting
Hint: "Create a Python file called greeter.py that asks for a name and prints a greeting"
Task 2: Run the Program¶
Ask Claude to run your program.
Hint: "Run greeter.py"
Task 3: Add a Feature¶
Modify greeter.py to also:
- Ask for the user's favorite color
- Include the color in the greeting
Hint: "Update greeter.py to also ask for and include their favorite color"
Task 4: Add a Time-Based Greeting¶
Modify greeter.py so the greeting changes based on time of day:
- "Good morning" before noon
- "Good afternoon" from noon to 6pm
- "Good evening" after 6pm
Hint: "Add time-based greetings - morning, afternoon, or evening"
Task 5: Run and Verify¶
Run the final program and test it.
Success Criteria¶
Your final greeter.py should:
- [ ] Ask for the user's name
- [ ] Ask for their favorite color
- [ ] Display a time-appropriate greeting
- [ ] Include both name and color in the output
Bonus Challenges¶
- Add error handling for empty inputs
- Create a
greeter_test.pyfile with simple tests - Add a "goodbye" message at the end
Reflection Questions¶
After completing this exercise, consider: - How did you phrase your requests to Claude? - Did Claude understand your intent on the first try? - What did you learn about effective prompting?
Solution¶
Don't peek until you've tried! But if you're stuck, here's an example interaction: