Let's say my students are able to write programs like this:
name = input("name")

if name == "Pete":
    greeting = "Hi"
    greeting = "Hello!"

{greeting} {name}!

I'd like to allow them start writing web-apps without introducing functions first (most web-frameworks require functions).

It occurred to me that it's not hard to create a wrapper, which presents this code as a web-app (input would be patched to look up GET or POST parameters with given name).

This approach would allow simple debugging of the code on local machine and no extra libraries are required in this phase.

Any opinions on this? Has this been tried before?

best regards,