Arbeiten mit DeepSeek in Python
James Chapman
AI Curriculum Lead, DataCamp
print(response.choices[0].message.content)
Schritt 1 - ...
Schritt 2 - ...
Endgültige Antwort: ...
reasoning_effort="high" oder "max"temperature hat keinen Effekt während des Reasonings✅ 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
"... Nimm dir Zeit und denke jeden Schritt durch."
❌ Höherer Token-Verbrauch
❌ Längere Antwortzeit


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)
Lass uns Schritt für Schritt zählen.
- Starte mit 1.
- Addiere noch eine 1.
- 1 + 1 = 2.
**Endgültige Antwort: 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)
Ich gehe die Funktion Schritt für Schritt durch.
Die Funktion nutzt eine while-Schleife: while start < 10. Dann wird start ausgegeben. Aber Moment –
in der Schleife gibt es kein Inkrement für die Variable start — das ist das Problem.
Die Lösung ist, start innerhalb der Schleife zu erhöhen. Zum Beispiel mit start += 1.
Hier ist der korrigierte Code:
def count_to_ten(start):
while start < 10:
print(start)
start += 1
return "Done"
count_to_ten(1)
Arbeiten mit DeepSeek in Python