That's an interesting idea!
Another option others have suggested is "ghost" results written next to each line, which shows "what would be printed if this was the last line" (which is a little bit different from "what would this line in isolation print", since that doesn't take into account prior line's definitions etc)
Yeah that ghost thing would also fix "my" usecase of just doing random math equations that are not related to each other at all, which I now just put at the bottom and shuffle around when needed.
In some other editors they work with execute what is selected. This way you can select multiple lines if you need predecessor evaluations