Trabajar con DeepSeek en Python
James Chapman
AI Curriculum Lead, DataCamp
print(response.choices[0].message.content)
Paso 1 - ...
Paso 2 - ...
Respuesta final: ...
reasoning_effort="high" o "max"temperature no tiene efecto mientras razona✅ What are the differences between lists and tuples in Python?
❌ In Python, there are different data structures. Lists are...
✅ Who developed the Python programming language?
❌
Example 1:
Q: Who developed the R programming language?
A: Ross Ihaka and Robert Gentleman
"... Take your time and think through each step."
❌ Más tokens consumidos
❌ Mayor tiempo de respuesta


response = client.chat.completions.create(
model="deepseek-ai/DeepSeek-V4.1-Flash",
messages=[{"role": "user", "content": "Return the result of 1+1."}]
)
print(response.choices[0].message.content)
Vamos a contar paso a paso.
- Empieza con 1.
- Suma otro 1.
- 1 + 1 = 2.
**Respuesta final: 2**



prompt = """
[Task: Fix the following code.]
Code:
def count_to_ten(start):
while start < 10:
print(start)
return "Done"
count_to_ten(1)
"""
print(response.choices[0].message.content)
Voy a revisar la función paso a paso.
La función usa un bucle while: while start < 10. Luego imprime start. Pero, espera: dentro del bucle
no se incrementa la variable start — ahí está el problema.
La solución es añadir un incremento de start dentro del bucle, como start += 1.
Aquí está el código corregido:
def count_to_ten(start):
while start < 10:
print(start)
start += 1
return "Done"
count_to_ten(1)
Trabajar con DeepSeek en Python