Робота з DeepSeek у Python
James Chapman
AI Curriculum Lead, DataCamp
print(response.choices[0].message.content)
Крок 1 — ...
Крок 2 — ...
Підсумкова відповідь: ...
reasoning_effort="high" або "max"temperature не впливає під час міркування✅ 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."
❌ Зростає використання токенів
❌ Зростає час відповіді


response = client.chat.completions.create(
model="deepseek-ai/DeepSeek-V4-Pro",
messages=[{"role": "user", "content": "Return the result of 1+1."}]
)
print(response.choices[0].message.content)
Давайте порахуємо крок за кроком.
- Почніть з 1.
- Додайте ще 1.
- 1 + 1 = 2.
**Підсумкова відповідь: 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)
Пройдуся функцією крок за кроком.
Функція використовує цикл while: while start < 10. Далі виводить start. Але в середині циклу
немає збільшення змінної start — у цьому проблема.
Виправлення — додати в циклі інкремент start. Наприклад, start += 1.
Ось виправлений код:
def count_to_ten(start):
while start < 10:
print(start)
start += 1
return "Done"
count_to_ten(1)
Робота з DeepSeek у Python