Analytical problem solving with Claude
After your successful promo, website traffic jumped 40 %, yet paid subscriptions crawled up only 5 %. Activate Claude’s extended thinking to unpack this mismatch: the detailed analysis will guide SkyTrack’s next growth sprint.
The anthropic
library and client
are preloaded.
This exercise is part of the course
Introduction to Claude Models
Exercise instructions
- Create an analytical thinking prompt.
- Use the
thinking
parameter in your API call to turn on extended thinking. - Set a high
max_tokens
, such as 1400, to give Claude enough room for reasoning and the answer. - Print the analysis results.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create an analytical thinking prompt
analysis_prompt = """
Analyze this business scenario and walk me through your reasoning:
Our website traffic increased 40% but sales only grew 5%.
___
Provide multiple possible explanations and rank them by likelihood.
"""
# Request detailed analytical thinking
response = client.messages.create(model="claude-3-7-sonnet-latest", thinking=____, max_tokens=____, messages=[{"role": "user", "content": analysis_prompt}])
# Print the analysis results
print("Analysis results:")
print(response.content[0].thinking)