開始使用免費開始

延遲評估

當 Python 依序執行以下指令稿時,當印出訊息「'Converting to percentage'」時,會跑到哪一行?

from dask import delayed

def fraction_to_percent(x):
     percentage = x * 100
     print('Converting to percentage')
     return x

frac = 0.3
percentage = delayed(fraction_to_percent)(frac)
computed_percentage = percentage.compute()

print(percentage)
print(computed_percentage)

你可以使用主控台來協助找出答案。工作階段中已經提供 fraction_to_percent() 函式。

本練習屬於課程

在 Python 中使用 Dask 進行平行程式設計

檢視課程

動手互動練習

將理論付諸實踐,立即體驗我們的互動練習

開始練習