Прескочи на главни садржај
🔒 Режим прегледа. Првих петнаест Foundations лекција је бесплатно; ова је Pro. Покрените 7-дневни trial да откључате едитор, AI савете и остатак курса. Картица је обавезна, можете отказати у било ком тренутку у Dashboard.Покрени 7-дневни trial →
← KurseviSenior Deep-DivesModule 1 · Concurrency internals · RecapМеморијски прикази и бафер протоколpredict32 / 161
+100 XP
Zadatak🌐 shown in EN
📝 **Question:** Predict the exact output. \`mv = memoryview(data)\` is a zero-copy WINDOW into the bytearray. Then \`slice_view = mv[0:5]\` is a smaller window into the SAME buffer. The question: does writing through \`slice_view\` change \`data\`? 📋 Pick the right answer. 💡 **Hint:** Re-read the theory above if unsure.
Predvidi izlaz

Pažljivo pročitaj kod

data = bytearray(b"hello world")
mv = memoryview(data)
print(f"original:{data.decode()}")

mv[6:11] = b"PYTHN"
print(f"after_view_write:{data.decode()}")

slice_view = mv[0:5]
print(f"slice:{bytes(slice_view).decode()}")

slice_view[0] = ord("H")
print(f"data_now:{data.decode()}")
print(f"mv_view:{bytes(mv).decode()}")

Šta će program ispisati? Napiši ovde: