Lazy evaluation
जब 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 के साथ Parallel Programming
इंटरैक्टिव व्यावहारिक अभ्यास
हमारे इंटरैक्टिव अभ्यासों में से किसी एक के साथ सिद्धांत को व्यवहार में बदलें
अभ्यास शुरू करें