시작하기무료로 시작하기

지연 평가

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로 병렬 프로그래밍

강의 보기

실습형 인터랙티브 연습문제

이론을 실습으로 바꾸는 인터랙티브 연습 중 하나를 만나보세요

연습 시작