1. Learn
  2. /
  3. 课程
  4. /
  5. Working with DeepSeek in Python

Connected

道练习

Coding with reasoning mode

Time for you to have a go at coding with DeepSeek V4-Pro's reasoning! As you may know, one important part of developing reliable code is to include tests, which validate that intermediate processes are running correctly before returning a final output. Well-written tests make debugging much easier!

Your colleague has handed-over a Python script they were working on, which you notice doesn't contain any tests. As you aren't familiar with the libraries or syntax used in the script, you'll lean on V4-Pro's default reasoning to add appropriate testing to the script in the form of assert statements. If you'd like to read more about assert statements, check out this DataCamp tutorial.

import numpy as np
a = np.arange(5)
b = a.reshape(-1, 1)
c = np.ones((5, 3))
d = np.hstack((b, c))
col_means = d.mean(axis=0)

说明

100 XP
  • Copy the code provided into the delimited prompt that has been started for you.
  • Send prompt to deepseek-ai/DeepSeek-V4-Pro.